[wp-trac] [WordPress Trac] #62946: wp_invalidate_opcache() promises more than it can do
WordPress Trac
noreply at wordpress.org
Tue Feb 11 22:21:59 UTC 2025
#62946: wp_invalidate_opcache() promises more than it can do
--------------------------+-----------------------------
Reporter: kkmuffme | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: major | Keywords:
Focuses: |
--------------------------+-----------------------------
wp_invalidate_opcache() (tries to) flush the in-memory opcache and by
doing so, accidentally introduces side-effects that most WP users won't be
aware of.
1) if opcache.file_cache is used, the invalidated file will reload it's
PREVIOUS (before invalidation) opcache data when PHP-FPM is restarted or
the opcache reset
When using opcache.file_cache and opcache.enable_cli=1, this means that
all CLI requests still operate using the old files, while the PHP-FPM
requests run on the new files.
2) if wp_invalidate_opcache() is called in CLI, it won't have any effect
(except for the current request if opcache.enable_cli=1 is used for the
current request itself), since the CLI SAPI doesn't have shared memory
with the FPM SAPI
This means that currently all CLI requests run on the new code, while PHP-
FPM still runs the old.
Which essentially makes wp_invalidate_opcache useless and in fact will
lead to confusion and issues especially when using WP CLI to update
core/plugins/themes.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62946>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list