Open Sinthorion opened 4 years ago
We talked about this error silencing operator in the Base::read() method on the slack channel last week. No one seems to know how or why it got there because it also will fail if you try to read a config file and it can't find the config file.
I imagine one reason to use the silencing operator rather than some explicit check like is_readable($file)
is that there are rare situations in which a file reports as readable but something during actually reading fails. It's also possible for is_readable()
to fail with an E_WARNING
. The PHP docs aren't clear about what can make these functions error out. The silencing operator is thus a catch-all for all these special cases.
But at the very least, error_clear_last()
should be called (possibly after checking error_get_last()
first) every time after using the silencing operator.
The built-in File-based cache engine checks cache entry existence by attempting a file read using the error silencing operator. This error from the file not existing will still be in PHP's error log (and populate
error_get_last()
).This is especially a problem in page caching: F3 checks the error log and refuses to cache the page if there was an error. Since the existence cache before rendering the page always produces an error with no cache present and this error prevents the cache from ever being filled, this means the
folder
cache engine can never cache a page, as is, unless I'm missing something.