Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.2.1 |
Just installed 3.2.1 on PHP 7.1 in production and got the following error logged to Sentry:
Symfony\Component\Debug\Exception\FatalErrorException: include(): Failed opening '/home/ticketswap/app/releases/20161213142627/app/cache/prod/annotations.php' for inclusion (include_path='.:/usr/share/php')
#1 /vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php(331): null
#0 Hautelook\SentryClient\ErrorHandler(null): Hautelook\SentryClient\ErrorHandler::handleFatalError
I had a similar issue in the PR I submitted yesterday #20883. That issue is now gone, but the next issue arises.
The issue is with this code:
/**
* Load the cache file.
*/
private function initialize()
{
$this->values = @(include $this->file) ?: array();
}
The error suppression still triggers an error (in PHP 7.1 with error_reporting = E_ALL
).
Isn't it better to first check if the file exists?