Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle] Fixed issue when a parameter contains a '%'#30930
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas commentedApr 7, 2019
Status: needs work |
ro0NL commentedApr 8, 2019
Hm, looking at the dumped XML.. i see: <parameterkey="templating.helper.code.file_link_format">subl://%f:%l</parameter><parameterkey="debug.file_link_format">subl://%f:%l</parameter> if i escape |
ro0NL commentedApr 8, 2019
shouldnt we always escape at the output level? 🤔 |
lyrixx commentedApr 8, 2019
@ro0NL Unfortunately, the dumped container does not really work. It contains escaped values, and un-escaped values. This is really not simple. IMHO, the simplest (and a bit dirty) solution is to continue in the way I started this PR :/ We should not try to recompile a compiled container, instead we should grep the dumped container, and extract all env var. This PR is almost done, but I'm not able to get the real default value. But I did not get enough time to work on it |
ro0NL commentedApr 8, 2019
but the xml is not compiled yet, at most it's an optimized dump from a compiled source. But IIUC we should be able to compile it again (and get the same result). from |
ro0NL commentedApr 8, 2019
i mean if we cant load a dumped XML and compile it as such.. that's another bug no? |
nicolas-grekas commentedApr 8, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I don't think it's a bug, there are tests making it pretty clear it's on purpose: if you dump a compiled container, you should not compile it again. That's the root of the issue here. If you dumped a non-compiled container, then the dumped file should keep references to parameters - thus encode |
ro0NL commentedApr 8, 2019
This leaves the container(builder) in PHP uncompiled though (i.e. |
nicolas-grekas commentedApr 8, 2019
I agree, would you mind having a look? |
ro0NL commentedApr 8, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hm this is hard :) in XML we could consider differentiating based on e.g. If so, we need to find another way to track |
nicolas-grekas commentedApr 8, 2019
preg_match_all() to the rescue, that's way enough to me for the targeted feature. |
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedMay 9, 2019
@lyrixx can you check this diff I just push-forced?https://github.com/symfony/symfony/compare/f682985882cd36351c55b9da27a16d02e58a6216..f1941605b3d1dc4a8010431b934b0a1d2a5d3fd6 |
nicolas-grekas commentedMay 9, 2019
@ro0NL I would appreciate your thoughts here too, since this builds on a PR of yours :) |
lyrixx commentedMay 9, 2019
OH, I was working on it ATM ! |
lyrixx commentedMay 9, 2019
@nicolas-grekas your patch did not work, it did not use the real default value. See my patch, I pushed force too (after you) |
lyrixx commentedMay 9, 2019
Looks like everything is OK: |
ro0NL commentedMay 9, 2019
seems now the other case is failing :) not sure if both cases are tested actually. in general the regex approach works for me 👍 |
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
lyrixx commentedMay 9, 2019
How did you get this error? I saw this is thrown is the CI but did you get it locally? |
ro0NL commentedMay 9, 2019
also looking at CI :) |
lyrixx commentedMay 10, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm fixing some issues, but I don't get why your regex is better. With I got: Where I got before: Could you give me some example of what I need to match |
ro0NL commentedMay 10, 2019
i thought it was nessecary to include default envs, in order to obtain the default values. But now you obtain them directly from the parameter bag, so it's not needed anymore. |
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
On my computer:```dump(get_cfg_var('xdebug.file_link_format'));"subl://%f:%l"```When I ran `bin/console debug:config framework` I got this exception:```In ParameterBag.php line 100: [Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException] The parameter "templating.helper.code.file_link_format" has adependency on a non-existent parameter "f:".Exception trace: () at/home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:100...```This issue was introduced[here](https://github.com/symfony/symfony/pull/27684/files#diff-b3847149480405e1de881530b4c75ab5L212)lyrixx commentedMay 10, 2019
Here we go ... |
nicolas-grekas commentedMay 10, 2019
because mine is more specific: |
lyrixx commentedMay 10, 2019
It should be OK. Tests pass locally and I guess it's the expected behavior on a regular app :) |
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedMay 11, 2019
Thank you@lyrixx. |
…'%' (lyrixx)This PR was merged into the 4.3 branch.Discussion----------[FrameworkBundle] Fixed issue when a parameter contains a '%'| Q | A| ------------- | ---| Branch? | master| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#31431| License | MIT| Doc PR |---On my computer:```dump(get_cfg_var('xdebug.file_link_format'));"subl://%f:%l"```When I ran `bin/console debug:config framework` I got this exception:```In ParameterBag.php line 100: [Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException] The parameter "templating.helper.code.file_link_format" has adependency on a non-existent parameter "f:".Exception trace: () at/home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:100...```This issue was introduced [here](https://github.com/symfony/symfony/pull/27684/files#diff-b3847149480405e1de881530b4c75ab5L212) / cc@ro0NLThis PR does not really fix the issue: I'm able to debug the config, Thethe `debug:container --env-vars` does not work anymore. How could we fixboth issue? cc@nicolas-grekasCommits-------7bcd714 [FrameworkBundle] Fixed issue when a parameter container a '%'
Uh oh!
There was an error while loading.Please reload this page.
On my computer:
When I ran
bin/console debug:config frameworkI got this exception:This issue was introducedhere / cc@ro0NL
This PR does not really fix the issue: I'm able to debug the config, The
the
debug:container --env-varsdoes not work anymore. How could we fixboth issue? cc@nicolas-grekas