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

WordPress Trac noreply at wordpress.org
Sat Jun 24 13:00:32 UTC 2023


#58220: Replace usage of substr with str_starts_with and str_ends_with
------------------------------+-----------------------------
 Reporter:  Soean             |       Owner:  SergeyBiryukov
     Type:  enhancement       |      Status:  closed
 Priority:  normal            |   Milestone:  6.3
Component:  General           |     Version:
 Severity:  normal            |  Resolution:  fixed
 Keywords:  has-patch commit  |     Focuses:  performance
------------------------------+-----------------------------

Comment (by SergeyBiryukov):

 In [changeset:"56015" 56015]:
 {{{
 #!CommitTicketReference repository="" revision="56015"
 General: Replace `substr_compare()` usage in the `str_ends_with()`
 polyfill.

 This avoids a warning on PHP < 7.2.18 if haystack is an empty string:
 {{{
 Warning: substr_compare(): The start position cannot exceed initial string
 length
 }}}

 Follow-up to [52040], [55158], [55990], [56014].

 See #58220.
 }}}

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


More information about the wp-trac mailing list