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

[Config] Early return for DirectoryResource #21458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 12, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
return false early from directory resource
  • Loading branch information
robfrawley committed Jan 30, 2017
commit 96107e21f14df1d31b3593e2a1df6dd5c24305dc
12 changes: 9 additions & 3 deletions 12 src/Symfony/Component/Config/Resource/DirectoryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ public function isFresh($timestamp)
return false;
}

$newestMTime = filemtime($this->resource);
if ($timestamp <= filemtime($this->resource)) {
Copy link
Member

@nicolas-grekas nicolas-grekas Jan 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be turned to a <: the "equals" case should not return false, as in eg FileResource

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It returned false before. Do we consider this behaviour change a bug fix?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check second commit (can squash if its good)

return false;
}

foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->resource), \RecursiveIteratorIterator::SELF_FIRST) as $file) {
// if regex filtering is enabled only check matching files
if ($this->pattern && $file->isFile() && !preg_match($this->pattern, $file->getBasename())) {
Expand All @@ -81,10 +84,13 @@ public function isFresh($timestamp)
continue;
}

$newestMTime = max($file->getMTime(), $newestMTime);
// early return if a file's mtime exceeds the passed timestamp
if ($timestamp <= $file->getMTime()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check second commit (can squash if its good)

return false;
}
}

return $newestMTime < $timestamp;
return true;
}

public function serialize()
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.