Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cab5763

Browse filesBrowse files
committed
return false early from directory resource
1 parent 6791124 commit cab5763
Copy full SHA for cab5763

File tree

1 file changed

+10
-2
lines changed
Filter options

1 file changed

+10
-2
lines changed

‎src/Symfony/Component/Config/Resource/DirectoryResource.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Resource/DirectoryResource.php
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ public function isFresh($timestamp)
7474
return false;
7575
}
7676

77-
$newestMTime = filemtime($this->resource);
77+
if (($newestMTime = filemtime($this->resource)) > $timestamp) {
78+
return false;
79+
}
80+
7881
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->resource), \RecursiveIteratorIterator::SELF_FIRST) as $file) {
7982
// if regex filtering is enabled only check matching files
8083
if ($this->pattern && $file->isFile() && !preg_match($this->pattern, $file->getBasename())) {
@@ -87,7 +90,12 @@ public function isFresh($timestamp)
8790
continue;
8891
}
8992

90-
$newestMTime = max($file->getMTime(), $newestMTime);
93+
// early return if any file mtime is greater than passed timestamp
94+
if (($fileMTime = $file->getMTime()) > $timestamp) {
95+
return false;
96+
}
97+
98+
$newestMTime = max($fileMTime, $newestMTime);
9199
}
92100

93101
return $newestMTime < $timestamp;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.