Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d5d84f6

Browse filesBrowse files
committed
bug #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 #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 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
Copy full SHA for d5d84f6

File tree

1 file changed

+1
-1
lines changed
Filter options

1 file changed

+1
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
+1-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.