[wp-trac] [WordPress Trac] #63175: Tests: Improve Unit tests for 'wp_unique_id_from_values()'

WordPress Trac noreply at wordpress.org
Wed Mar 26 22:08:16 UTC 2025


#63175: Tests: Improve Unit tests for 'wp_unique_id_from_values()'
--------------------------------------+---------------------
 Reporter:  joemcgill                 |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  6.8
Component:  General                   |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  tests
--------------------------------------+---------------------

Comment (by peterwilsoncc):

 According to the Stack Overflow post
 [https://stackoverflow.com/questions/28925559/json-encode-behaving-
 differently-on-dev-vs-live-servers json_encode behaving differently on dev
 vs live servers], the cause of the different results is due to different
 MySQL extensions.

 The issue this presents is that if a developer writes CSS on the
 development server expecting `wp_unique_id_from_values()` to return a
 consistent result, their CSS may end up broken on their live server as the
 unique ID is not in fact unique based on the values.

 I think it would be good to test if `md5( serialize() )` returns
 consistent results, regardless of the extensions installed. This may
 present a risk for the `__serialize()` and `__sleep()` magic methods,
 although it doesn't appear to be a huge risk as blocks typically use
 stdClass.

 This may be moot if `json_decode()` behaves differently on different
 systems too.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63175#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list