Skip to content

[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

Merged
merged 1 commit into from
Jan 28, 2021

Conversation

xabbuh
Copy link
Member

@xabbuh 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

@carsonbot carsonbot added this to the 4.4 milestone Jan 28, 2021
@carsonbot carsonbot changed the title [Finder] use proper keys to not override appended files [Finder]  use proper keys to not override appended files Jan 28, 2021
@@ -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;
Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Contributor

@shyim shyim left a 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

@nicolas-grekas
Copy link
Member

Thank you @xabbuh.

@nicolas-grekas nicolas-grekas merged commit e242832 into symfony:4.4 Jan 28, 2021
@xabbuh xabbuh deleted the issue-40022 branch January 28, 2021 17:20
@fabpot fabpot mentioned this pull request Feb 3, 2021
@fabpot fabpot mentioned this pull request Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants