bug #19636 [Finder] no PHP warning on empty directory iteration (ggottwald)

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
This commit is contained in:
Fabien Potencier 2016-09-14 14:03:47 -07:00
commit 23cae581b8
1 changed files with 4 additions and 0 deletions

View File

@ -137,6 +137,10 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
return $this->rewindable;
}
if ('' === $this->getPath()) {
return $this->rewindable = false;
}
if (false !== $stream = @opendir($this->getPath())) {
$infos = stream_get_meta_data($stream);
closedir($stream);