Skip to content

Commit

Permalink
Checked result value of glob()
Browse files Browse the repository at this point in the history
  • Loading branch information
webmozart committed Dec 23, 2015
1 parent 1b60f67 commit ee2e309
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

* 3.3.1 (@release_date@)

* checked return value of `glob()`

* 3.3.0 (2015-12-23)

* improved globbing performance by falling back to PHP's `glob()` function
Expand Down
6 changes: 5 additions & 1 deletion src/Iterator/GlobIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ public function __construct($glob, $flags = 0)
$glob = str_replace('\\', '\\\\', $glob);
}

$innerIterator = new ArrayIterator(glob($glob, GLOB_BRACE));
if (false === $results = glob($glob, GLOB_BRACE)) {
$innerIterator = new EmptyIterator();
} else {
$innerIterator = new ArrayIterator($results);
}
} else {
// Otherwise scan the glob's base directory for matches
$innerIterator = new GlobFilterIterator(
Expand Down

0 comments on commit ee2e309

Please sign in to comment.