minor #26031 [Config] Only using filemtime to check file freshness (dmifedorenko)

This PR was merged into the 3.4 branch.

Discussion
----------

[Config] Only using filemtime to check file freshness

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

Commits
-------

52c9cb4 [Config] Only using filemtime to check file freshness
This commit is contained in:
Nicolas Grekas 2018-02-04 15:53:45 +01:00
commit cb6c48cc36
2 changed files with 3 additions and 3 deletions

View File

@ -60,7 +60,7 @@ class FileResource implements SelfCheckingResourceInterface, \Serializable
*/
public function isFresh($timestamp)
{
return file_exists($this->resource) && @filemtime($this->resource) <= $timestamp;
return false !== ($filemtime = @filemtime($this->resource)) && $filemtime <= $timestamp;
}
public function serialize()

View File

@ -40,11 +40,11 @@ class ReflectionClassResource implements SelfCheckingResourceInterface, \Seriali
}
foreach ($this->files as $file => $v) {
if (!file_exists($file)) {
if (false === $filemtime = @filemtime($file)) {
return false;
}
if (@filemtime($file) > $timestamp) {
if ($filemtime > $timestamp) {
return $this->hash === $this->computeHash();
}
}