Skip to content

[DependencyInjection] Fix XmlFileLoader not respecting when env for services #58299

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

Conversation

CipherdevNL
Copy link

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #58293
License MIT

This PR resolves a bug inside the XmlFileLoader that causes the loading of all services inside a <when env="..." /> elements even when not in the defined environment.

My knowledge about xPath is very limited, but it seems like the parser interpets .// as // (anywhere) while most like ./ (relative) was meant, due to the passing of an $root element. Based on the added test and passing of existing test this change seems like sufficient to respect the <when env="...." />

@CipherdevNL CipherdevNL force-pushed the 5.4_58293-fix-xmlfileloader-when-env branch from 4c4e3bf to 2ec78d9 Compare September 18, 2024 12:40
@CipherdevNL
Copy link
Author

Small bump to check if there is anything additional required from my side.

@nicolas-grekas nicolas-grekas changed the title [DependencyInjection] Fix XmlFileLoader not respecting when env for… [DependencyInjection] Fix XmlFileLoader not respecting when env for services Sep 28, 2024
@nicolas-grekas
Copy link
Member

Thank you @CipherdevNL.

@nicolas-grekas nicolas-grekas merged commit fe74ff3 into symfony:5.4 Sep 28, 2024
11 of 12 checks passed
This was referenced Oct 27, 2024
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.

5 participants