minor #41412 [HttpKernel] Fixes file_get_content in HttpCache's Store for PHP7.4+ (0x346e3730)

This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] Fixes file_get_content in HttpCache's Store for PHP7.4+

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

While trying to get 6.0 branch tests green, I encountered an error on multiple HttpKernel tests.
After investigating, it comes from the file_get_contents in the load method of the Store class from HttpCache. For obscure reasons, some calls are in errors and the content can't be read for "permission denied".
This is happening only on PHP 7.4.0+ (and that explains why the tests are green on the branch 5.4 as it runs php 7.2), adding the `@` error suppressor fixes this.

Commits
-------

c3ac11cc64 [HttpKernel] Fixes tests for PHP7.4+
This commit is contained in:
Nicolas Grekas 2021-05-26 19:22:19 +02:00
commit 12030e5622

View File

@ -349,7 +349,7 @@ class Store implements StoreInterface
{
$path = $this->getPath($key);
return file_exists($path) && false !== ($contents = file_get_contents($path)) ? $contents : null;
return file_exists($path) && false !== ($contents = @file_get_contents($path)) ? $contents : null;
}
/**