Skip to content
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

Silent error in file caching #304

Open
Sinthorion opened this issue Sep 7, 2020 · 2 comments
Open

Silent error in file caching #304

Sinthorion opened this issue Sep 7, 2020 · 2 comments

Comments

@Sinthorion
Copy link

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.

@n0nag0n
Copy link
Member

n0nag0n commented Sep 8, 2020

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.

@Sinthorion
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants