-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Status: needs work |
Hm, looking at the dumped XML.. i see: <parameter key="templating.helper.code.file_link_format">subl://%f:%l</parameter>
<parameter key="debug.file_link_format">subl://%f:%l</parameter> if i escape |
shouldnt we always escape at the output level? 🤔 |
@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 |
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 |
i mean if we cant load a dumped XML and compile it as such.. that's another bug no? |
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 |
This leaves the container(builder) in PHP uncompiled though (i.e. |
I agree, would you mind having a look? |
Hm this is hard :) in XML we could consider differentiating based on e.g. If so, we need to find another way to track |
preg_match_all() to the rescue, that's way enough to me for the targeted feature. |
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
Outdated
Show resolved
Hide resolved
@lyrixx can you check this diff I just push-forced? https://github.com/symfony/symfony/compare/f682985882cd36351c55b9da27a16d02e58a6216..f1941605b3d1dc4a8010431b934b0a1d2a5d3fd6 |
@ro0NL I would appreciate your thoughts here too, since this builds on a PR of yours :) |
OH, I was working on it ATM ! |
@nicolas-grekas your patch did not work, it did not use the real default value. See my patch, I pushed force too (after you) |
Looks like everything is OK:
|
seems now the other case is failing :) not sure if both cases are tested actually. in general the regex approach works for me 👍 |
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
Outdated
Show resolved
Hide resolved
How did you get this error? I saw this is thrown is the CI but did you get it locally? |
also looking at CI :) |
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 |
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
Outdated
Show resolved
Hide resolved
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 a dependency 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)
Here we go ... |
because mine is more specific: |
It should be OK. Tests pass locally and I guess it's the expected behavior on a regular app :) |
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 a dependency 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 @ro0NL This PR does not really fix the issue: I'm able to debug the config, The the `debug:container --env-vars` does not work anymore. How could we fix both issue? cc @nicolas-grekas Commits ------- 7bcd714 [FrameworkBundle] Fixed issue when a parameter container a '%'
On my computer:
When I ran
bin/console debug:config framework
I got this exception:This issue was introduced here / cc @ro0NL
This PR does not really fix the issue: I'm able to debug the config, The
the
debug:container --env-vars
does not work anymore. How could we fixboth issue? cc @nicolas-grekas