8000 bug #19636 [Finder] no PHP warning on empty directory iteration (ggot… · symfony/symfony@23cae58 · GitHub
[go: up one dir, main page]

Skip to content

Commit 23cae58

Browse files
committed
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
2 parents 81e9713 + 695e341 commit 23cae58

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ public function isRewindable()
137137
return $this->rewindable;
138138
}
139139

140+
if ('' === $this->getPath()) {
141+
return $this->rewindable = false;
142+
}
143+
140144
if (false !== $stream = @opendir($this->getPath())) {
141145
$infos = stream_get_meta_data($stream);
142146
closedir($stream);

0 commit comments

Comments
 (0)
0