-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Finder] use proper keys to not override appended files #40023
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
xabbuh
commented
Jan 28, 2021
Q | A |
---|---|
Branch? | 4.4 |
Bug fix? | yes |
New feature? | no |
Deprecations? | no |
Tickets | Fix #40022 |
License | MIT |
Doc PR |
@@ -669,7 +669,8 @@ public function append($iterator) | |||
} elseif ($iterator instanceof \Traversable || \is_array($iterator)) { | |||
$it = new \ArrayIterator(); | |||
foreach ($iterator as $file) { | |||
$it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file)); | |||
$file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file); | |||
$it[$file->getRealPath()] = $file; |
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.
This won't work for non-existing files. Not sure if that's an issue though.
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.
Instead of getRealPath()
, I suggest usinggetPathname()
, which would also work for stream wrappers not supporting realpath()
.
Non-existent files are OK to me. I don't think this is an expected supported case for the Finder anyway.
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.
Our Swagger page does load again with this fix
Thank you @xabbuh. |