Skip to content

Commit

Permalink
bug #19636 [Finder] no PHP warning on empty directory iteration (ggot…
Browse files Browse the repository at this point in the history
…twald)

This PR was squashed before being merged into the 2.7 branch (closes #19636).

Discussion
----------

[Finder] no PHP warning on empty directory iteration

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | Since RecursiveDirectoryIterator::SKIP_DOTS is set as flag, opendir gets a warning if an empty directory is reached

Commits
-------

695e341 [Finder] no PHP warning on empty directory iteration
  • Loading branch information
fabpot committed Sep 14, 2016
2 parents 81e9713 + 695e341 commit 23cae58
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -137,6 +137,10 @@ public function isRewindable()
return $this->rewindable;
}

if ('' === $this->getPath()) {
return $this->rewindable = false;
}

if (false !== $stream = @opendir($this->getPath())) {
$infos = stream_get_meta_data($stream);
closedir($stream);
Expand Down

0 comments on commit 23cae58

Please sign in to comment.