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

Skip to content

Warning on cache:warmup with empty var/cache dir #27234

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

Closed
antonmedv opened this issue May 11, 2018 · 5 comments
Closed

Warning on cache:warmup with empty var/cache dir #27234

antonmedv opened this issue May 11, 2018 · 5 comments

Comments

@antonmedv
Copy link

Symfony version(s) affected: 4.1.x

Description
Running bin/console cache:warmup on empty cache dir triggers error reporting to rollbar, really annoying.

How to reproduce

  • Remove/or create empty var/cache dir
  • Run bin/console cache:warmup
  • E_WARNING
    include(/.../var/cache/prod/srcProdProjectContainer.php):: include(...): failed to open stream: No such file or directory
    

Possible Solution
Do NOT trigger E_WARNING.

Additional context

if (null === $oldContainer) {
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
try {
$oldContainer = include $cache->getPath();
} catch (\Throwable $e) {
} catch (\Exception $e) {
} finally {
error_reporting($errorLevel);
}
}

@nicolas-grekas
Copy link
Member

nicolas-grekas commented May 12, 2018

Can you share some steps to reproduce the issue? I just did this but failed to reproduce:

composer create-project -s dev symfony/skeleton
cd skeleton
rm var/cache -rf
./bin/console c:w

@antonmedv
Copy link
Author

Yes, output is ok to console. Try to add rollbar or set error handler.

@nicolas-grekas
Copy link
Member

So, this is a silenced error, there's no bug here, that's how things work...

@xabbuh
Copy link
Member

xabbuh commented May 13, 2018

I am going to close as explained.

@nicolas-grekas
Copy link
Member

Hum, we can still prevent the notice in the usual case, see #27249

fabpot added a commit that referenced this issue May 18, 2018
…tice (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] do file_exists() check instead of silent notice

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #27234
| License       | MIT
| Doc PR        | -

Commits
-------

f8cde70 [HttpKernel] do file_exists() check instead of silent notice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants