[wp-trac] [WordPress Trac] #58220: Replace usage of substr with str_starts_with and str_ends_with

WordPress Trac noreply at wordpress.org
Fri Apr 28 10:53:45 UTC 2023


#58220: Replace usage of substr with str_starts_with and str_ends_with
--------------------------+------------------------------
 Reporter:  Soean         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by Clorith):

 These functions were introduced with PHP 8, so before this can be properly
 considered, WordPress core would need a minimum PHP version of 8.0, which
 I think is a bit premature still, when looking at the overall PHP version
 stats.

 Alternatively, core would need to create a polyfill for the functions,
 although possible, that feels like the wrong direction to me. Of course,
 if there's some substantial performance gains for those running on PHP 8
 already, then it would be considered, but this would need to be well
 documented first :)

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


More information about the wp-trac mailing list