[wp-trac] [WordPress Trac] #55105: Introduce a polyfill for `array_is_list()`.

WordPress Trac noreply at wordpress.org
Mon Feb 5 14:21:36 UTC 2024


#55105: Introduce a polyfill for `array_is_list()`.
--------------------------------------+---------------------
 Reporter:  costdev                   |       Owner:  (none)
     Type:  feature request           |      Status:  closed
 Priority:  normal                    |   Milestone:  6.5
Component:  General                   |     Version:
 Severity:  minor                     |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+---------------------

Comment (by costdev):

 @swissspidy The polyfill in
 [https://core.trac.wordpress.org/changeset/57337 r57337] is exponentially
 less performant than the one proposed in this ticket. `array_values()` is
 O(n), for example, and it also includes a second passover that I wasn't
 able to find a scenario for. See [https://github.com/WordPress/wordpress-
 develop/pull/2289/files#r800939773 this thread] for where I looked at
 Symfony's polyfill and also mention the inconsistent performance of
 `array_values()`.

 The polyfill in [https://core.trac.wordpress.org/changeset/57337 r57337]
 also has no tests, which is common practice for polyfills.

 I'd suggest that we consider the polyfill in this ticket's PR and its
 accompanying tests to replace the polyfill in that changeset.

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


More information about the wp-trac mailing list