[wp-trac] [WordPress Trac] #50784: Stop using `preg_match()` in `wp_opcache_invalidate()`
WordPress Trac
noreply at wordpress.org
Mon Jul 27 12:30:34 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 | Focuses:
-----------------------------+---------------------
Comment (by mikeschroder):
All of these are faster than what is there now.
[attachment:"50784.substr_compare.diff"] is the fastest here, but I
noticed that in the [https://www.php.net/manual/en/function.substr-
compare.php PHP docs], a warning gets thrown if the string is too short,
so [attachment:"50784.substr_compare_warning.diff"] works around that.
Since that comes out pretty terse, I like the approach @jnylen0 used in a
previous patch, in [attachment:"50784.substr.diff"] quite a bit. This is
slower, but much more readable.
Would appreciate any opinions.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50784#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list