Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpKernel] Add is_file() check before include #40516

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

Merged

Conversation

burned42
Copy link
Contributor

@burned42 burned42 commented Mar 19, 2021

Q A
Branch? 4.4
Bug fix? yes (?)
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

I recently noticed that on every deployment I got warnings reported by sentry from the cache:clear command.

Warning: include(/var/www/html/var/cache/pro_/App_KernelProdContainer.php): failed to open stream: No such file or directory

In Symfony\Component\HttpKernel\Kernel line 469
(on 4.4 it's on line 536)

This is because the code tries to include the $cachePath without checking if it exists/is a file first. It seems like something similar was fixed some time ago already (#27249) some lines above.

This PR fixes the mentioned warnings for me.

I'm running on Symfony 5.2.5 at the moment, but the docs said that bugfixes should target branch 4.4 and new features should target 5.x, and I guess this could rather be seen as a bugfix than a new feature, so I branched off of 4.4 and also set this as target for the PR, I hope that's correct.

Trying to include a file that doesn't exist issues a warning. Doing an
is_file check beforehand should prevent those warnings.
@nicolas-grekas
Copy link
Member

I suppose you're having the issue because your error handler doesn't correctly handle the error_reporting() level, since the error should be silenced. Anyway, I'm fine with doing this change.

@nicolas-grekas
Copy link
Member

Thank you @burned42.

@nicolas-grekas nicolas-grekas merged commit a2d534c into symfony:4.4 Mar 19, 2021
@burned42
Copy link
Contributor Author

I suppose you're having the issue because your error handler doesn't correctly handle the error_reporting() level, since the error should be silenced. Anyway, I'm fine with doing this change.

Thanks for the hint, I didn't notice any (other) issues yet regarding my error handler, but I'll recheck my configs 👍

Also thanks for reviewing/merging so fast :)

@burned42 burned42 deleted the add_is_file_check_before_include branch March 19, 2021 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants