-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Finder] no PHP warning on empty directory iteration #19636
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
Conversation
ggottwald
commented
Aug 16, 2016
•
edited
Loading
edited
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 |
@@ -137,6 +137,10 @@ public function isRewindable() | |||
return $this->rewindable; | |||
} | |||
|
|||
if ($this->getPath() === '') { | |||
return $this->rewindable = false; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test should probably be added to cover this scenario
@ggottwald Can you update the empty title to something relevant? Thanks. |
https://gist.github.com/ggottwald/07194dc7926ae9093b773ec2297116f3 |
@ggottwald could you please add a test case? |
Sorry for the late response. Until now I was not able to force a catchable warning in the test. |
👍 |
@@ -137,6 +137,10 @@ public function isRewindable() | |||
return $this->rewindable; | |||
} | |||
|
|||
if ($this->getPath() === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be using a Yoda condition: '' === $this->getPath()
Thank you @ggottwald. |
…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