-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix remaining readdir() calls in loops with undesirable false evaluation potential #38630
Fix remaining readdir() calls in loops with undesirable false evaluation potential #38630
Conversation
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.
Sure, avoid "falsy" and ensure "false". 🆗
@@ -260,7 +260,7 @@ | |||
} | |||
|
|||
$dh = $this->opendir($path); | |||
while ($file = readdir($dh)) { | |||
while (($file = readdir($dh)) !== false) { |
Check notice
Code scanning / Psalm
PossiblyFalseArgument Note
@@ -526,7 +526,7 @@ | |||
} | |||
|
|||
$dh = $this->opendir($source); | |||
while ($file = readdir($dh)) { | |||
while (($file = readdir($dh)) !== false) { |
Check notice
Code scanning / Psalm
PossiblyFalseArgument Note
I wonder if these Psaml warnings worth something like:
🤔 |
ac5dfeb
to
84cc3a2
Compare
I don't think any of these test fails are related to this PR. 😕 |
…on potential Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
84cc3a2
to
e7cbaf3
Compare
The psalm warnings are likely not new, but silenced before. |
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
Rebased! Let's hope it works this time !! 💪 |
🎉 🎉 🎉 |
/backport to stable29 |
/backport to stable28 |
/backport to stable30 |
Summary
Fixes all remaining
readdir()
calls within loops that had undesirable false evaluation potential (at least inserver
)There weren't too many left and the bulk were in tests. The most notable not in tests were these:
copy()
in\OC\Files\Storage\Common
isEmpty()
inOCA\Files_Trashbin\Trashbin
copyRecursive()
inOC\Files\Storage\PolyFill\CopyDirectory
Ref: https://www.php.net/manual/en/function.readdir.php
TODO
Checklist