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 96107e2

Browse filesBrowse files
committed
return false early from directory resource
1 parent f7ba71d commit 96107e2
Copy full SHA for 96107e2

File tree

1 file changed

+9
-3
lines changed
Filter options

1 file changed

+9
-3
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Resource/DirectoryResource.php
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ public function isFresh($timestamp)
6868
return false;
6969
}
7070

71-
$newestMTime = filemtime($this->resource);
71+
if ($timestamp <= filemtime($this->resource)) {
72+
return false;
73+
}
74+
7275
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->resource), \RecursiveIteratorIterator::SELF_FIRST) as $file) {
7376
// if regex filtering is enabled only check matching files
7477
if ($this->pattern && $file->isFile() && !preg_match($this->pattern, $file->getBasename())) {
@@ -81,10 +84,13 @@ public function isFresh($timestamp)
8184
continue;
8285
}
8386

84-
$newestMTime = max($file->getMTime(), $newestMTime);
87+
// early return if a file's mtime exceeds the passed timestamp
88+
if ($timestamp <= $file->getMTime()) {
89+
return false;
90+
}
8591
}
8692

87-
return $newestMTime < $timestamp;
93+
return true;
8894
}
8995

9096
public function serialize()

0 commit comments

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