Skip to content

Commit

Permalink
minor #33016 [HttpKernel] Resilience against file_get_contents() race…
Browse files Browse the repository at this point in the history
… conditions (derrabus)

This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] Resilience against file_get_contents() race conditions

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

This PR addresses #33007 (comment).

Commits
-------

5892837 Resilience against file_get_contents() race conditions.
  • Loading branch information
nicolas-grekas committed Aug 8, 2019
2 parents e48d2c1 + 5892837 commit ce09c31
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpKernel/HttpCache/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private function load($key)
{
$path = $this->getPath($key);

return file_exists($path) ? file_get_contents($path) : null;
return file_exists($path) && false !== ($contents = file_get_contents($path)) ? $contents : null;
}

/**
Expand Down

0 comments on commit ce09c31

Please sign in to comment.