-
-
Notifications
You must be signed in to change notification settings - Fork 529
Fix Zend OPcache API warning when upgrading MODX #15911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Zend OPcache API warning when upgrading MODX #15911
Conversation
phpcs is failing because of this:
|
I'm afraid we are oversimplifying the problem here. If opcache is enabled and calling the function is restricted in setup, I believe we need to warn the user and stop setup. Otherwise, we are going to load stale settings here and problems will arise. Or we need to find another way to make sure opcache is not used for setup. |
My recommendation is to
|
At runtime this will only disable OPCache for the current request (it disables caching of the remaining scripts in your current request). And if I understand correctly, the files already in cache are not invalidated. Other requests might still use the cached scripts/files. Therefore we need to invalidate it by calling |
@JoshuaLuckers As far as I understand, as long as the script file isn't yet included it will bypass the OPcache entirely. You'd definitely want to short circuit it as soon as possible. |
I was looking at the PHP source code and if I'm not mistaken, calling |
We've gone from over-simplifying to over-complicating. 😂 This was added because the cached settings values that were just written to the file were not getting loaded in this exact spot, causing old values to be used during this step of the upgrade. Adding this method fixed that problem, absolutely. If we prevent the settings file from ever being cached by turning this off for all of the setup, we can avoid the problem completely, I believe. This will of course require testing. |
I agree, we should turn off OPCache for all of the setup. I propose to always turn off OPCache if it's enabled, even if we are not restricted to call @Omeryl recommends to ini_set() opcache.enable to false for the set up, which is something that can be done at runtime, at the earliest as possible. If it's ok with all of you to disable OPCache I will add a check to see if OPCache is enabled and disable it in both cli-install.php and index.php. |
This has never affected cli-install, to my knowledge. I believe it is unique to web install. Let's start with web and if the issue comes up, we can push the changes to cli. |
@opengeek done! |
What does it do?
Check if we are allowed to call OPcache API functions.
Why is it needed?
To fix an OPcache API functions warning during upgrades.
How to test?
See issue #15897
Related issue(s)/PR(s)
Closes #15897