jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

v1.5.4+ no longer support read-only wp-cache-config.php

Open oxyc opened this issue 6 years ago • 5 comments

In https://github.com/Automattic/wp-super-cache/commit/3dd7420dc37ee37b27a029b5be16e6abe345b45e the possibility to have wp-cache-config.php read-only broke due to constant writes without checking permissions first.

This can be reproduced by removing write access to the wp-cache-config.php file and triggering GC by saving a post. It causes a white screen with the permission problem mentioned.

oxyc avatar Oct 03 '17 13:10 oxyc

Did you get a PHP fatal error? This is a permission check in the wp_cache_replace_line() function that updates the config file. Currently a warning is displayed to the browser but in 1.5.6 (which will be released soon) that warning is changed to a trigger_error().

Can you grab the code from here (master) and give it a spin? It will unfortunately send error messages to your PHP error log but no text should be sent to the browser.

donnchawp avatar Oct 03 '17 13:10 donnchawp

Ah great, thanks for the quick response. No it was not a fatal error, just the message which will be fixed then.

I'll still unhook that action on our sites so it doesn't write to the error log on every gc run.

oxyc avatar Oct 03 '17 13:10 oxyc

I can close this if you consider the error log messages to be working as intended.

oxyc avatar Oct 03 '17 13:10 oxyc

No, leave this open. A better way to handle the issue is to report an error at a set rate rather than all the time to avoid clogging up the log files.

Or even not report an error at all if the plugin was in some sort of "read only" mode.

donnchawp avatar Oct 03 '17 15:10 donnchawp

Hiding the error when in "read only" mode sounds great. I think it's a valid use case to not allow the webserver write access to PHP files. Coming from a Drupal background that was an obvious decision on my part and I bet it's common for others to make that same decision too.

oxyc avatar Oct 06 '17 14:10 oxyc