8000 bug #20252 Trim constant values in XmlFileLoader (lstrojny) · src-run/symfony@d5d84f6 · GitHub
[go: up one dir, main page]

Skip to content

Commit d5d84f6

Browse files
committed
bug symfony#20252 Trim constant values in XmlFileLoader (lstrojny)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes symfony#20252). Discussion ---------- Trim constant values in XmlFileLoader | Q | A | ------------- | --- | Branch? | 2.7, 2.8, 3.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n.A. | License | MIT | Doc PR | n.A. When an XML config file gets long, it's nice to put the constant name into the next line 8000 like this: ```xml <parameter key="som_very_very_long_constant_name" type="constant"> Some\Namespace\That\Is\Sufficiently\Long\To\Require\A\LineBreak::someLongishConstantName </parameter> ``` If that’s the case, `constant()` will try and find a constant including the spaces. While it is theoretically possible to have a constant in PHP that starts or ends with a space, it’s impossible for class constants and only doable using `define(" FOO ", …);`. So that’s probably an edge case we can ignore. Commits ------- f09e621 Trim constant values in XmlFileLoader
2 parents 8974d77 + f09e621 commit d5d84f6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $lowercase = true)
391391
$arguments[$key] = $arg->nodeValue;
392392
break;
393393
case 'constant':
394-
$arguments[$key] = constant($arg->nodeValue);
394+
$arguments[$key] = constant(trim($arg->nodeValue));
395395
break;
396396
default:
397397
$arguments[$key] = XmlUtils::phpize($arg->nodeValue);

0 commit comments

Comments
 (0)
0