[wp-trac] [WordPress Trac] #58206: Replace usage of strpos with str_contains

WordPress Trac noreply at wordpress.org
Mon Jun 12 08:47:57 UTC 2023


#58206: Replace usage of strpos with str_contains
-------------------------------------+-------------------------------------
 Reporter:  spacedmonkey             |       Owner:  SergeyBiryukov
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  6.3
Component:  General                  |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  good-first-bug has-      |     Focuses:  performance, coding-
  patch 2nd-opinion commit           |  standards
-------------------------------------+-------------------------------------

Comment (by mikeschroder):

 Hi! I read through this ticket, and I noticed that there are two
 performance tests, with different results, and two different
 interpretations of the impact.

 I wanted to check an assumption here: Is it correct that the test from
 @azaozz is on the specific function being changed, and the one from
 @spacedmonkey is a holistic / integration test that shows the total
 performance impact, including however often the polyfill / new function is
 used?

 If my understanding is correct, and the total performance impact in
 practice is low / negligible, I like this change. It moves core in the
 direction of more modern PHP practices, and, in my opinion (I realize this
 is subjective), makes the resulting code more readable, too.

 Would certainly be open to other performance tests as well, to verify
 assumptions, if anyone has the availability to do so.

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


More information about the wp-trac mailing list