-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Trim constants #8661
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
Created a test for simple constant support in XML configuration files.
Added a fixture with an indented constant. This currently throws an exception: """constant(): Couldn't find constant PHP_EOL """ This might be caused because the parameter value is not trimmed.
Fixed the exception throwed when indenting constants in XML configuration files, by simply trimmed constants.
This is already proposed multiple times and refused. The reason (see #4463 ):
|
Then maybe the first commit, which adds a test for constant support, can still be useful? I'd be curious to see cases where whitespaces are used for constant names. |
Whitespaces for constant names are not common, but we can't make an exception for some values. See also #3646 |
@wouterj yes, I was looking at this PR, and also at its related issue #3644 and another PR #6123. While I still don't understand why this behavior should be kept, I think I'm going to take another approach: I'll submit a PR to add a test on constants support and another one on the component documentation. |
👍 for both of those PR you're going to create. I missed the test commit and we also don't have this documented. |
@gnugat People may want to define some parameters with whitespaces in it. If we are trimming the value, it becomes impossible |
This PR was squashed before being merged into the master branch (closes #8663). Discussion ---------- [DependencyInjection] Test constants | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | **yes** | License | MIT Added a test for constant support in XML configuration files. Related PR: #8661 Commits ------- 9acedb7 [DependencyInjection] Test constants
In XML configuration, the value between` parameter` tags isn't trimmed, which can lead to unexpected behavior. See symfony/symfony#8661
When indenting constant parameters in XML configuration files, an exception is throwed.
This PR simply adds:
Example to reproduce the bug
Configuration sample:
Code sample:
Result:
Notice the fact that the error message is not: