8000 minor #26031 [Config] Only using filemtime to check file freshness (d… · symfony/symfony@cb6c48c · GitHub
[go: up one dir, main page]

Skip to content

Commit cb6c48c

Browse files
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
2 parents ae96700 + 52c9cb4 commit cb6c48c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Symfony/Component/Config/Resource/FileResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getResource()
6060
*/
6161
public function isFresh($timestamp)
6262
{
63-
return file_exists($this->resource) && @filemtime($this->resource) <= $timestamp;
63+
return false !== ($filemtime = @filemtime($this->resource)) && $filemtime <= $timestamp;
6464
}
6565

6666
public function serialize()

src/Symfony/Component/Config/Resource/ReflectionClassResource.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public function isFresh($timestamp)
4040
}
4141

4242
foreach ($this->files as $file => $v) {
43-
if (!file_exists($file)) {
43+
if (false === $filemtime = @filemtime($file)) {
4444
return false;
4545
}
4646

47-
if (@filemtime($file) > $timestamp) {
47+
if ($filemtime > $timestamp) {
4848
return $this->hash === $this->computeHash();
4949
}
5050
}

0 commit comments

Comments
 (0)
0