[wp-trac] [WordPress Trac] #50784: Stop using `preg_match()` in `wp_opcache_invalidate()`

WordPress Trac noreply at wordpress.org
Tue Jul 28 07:08:54 UTC 2020


#50784: Stop using `preg_match()` in `wp_opcache_invalidate()`
------------------------------+---------------------
 Reporter:  mikeschroder      |       Owner:  (none)
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  5.5
Component:  Upgrade/Install   |     Version:  trunk
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |     Focuses:
------------------------------+---------------------

Comment (by mikeschroder):

 Thanks so much both!

 @desrosj Nice! I wish we could use the method that is 7.1+. Maybe when
 WordPress starts requiring it.

 The `in_array()` pass you wrote is a bit faster in my testing. I think
 it's easier to read than the first couple approaches, even if not as much
 as the latter. It doesn't catch *quite* as many files, although I'm
 guessing not very many are named `.Php`.

 Since it seems we all liked [attachment:"50784.substr.diff"] and it lines
 up with some existing methods in core (thanks, @SergeyBiryukov!), I think
 it makes sense to go ahead and do that for now.

 If we see issues with performance, we could come back to the `in_array()`
 approach, perhaps?

 As we're near RC, I'll get that taken care of for now, and we can iterate
 if y'all would like.

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


More information about the wp-trac mailing list