Browse Source

[DependencyInjection] fixed int casting for XML files (based on what is done in the YAML component)

Fabien Potencier 13 years ago
parent
commit
8dcde3c076
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/Symfony/Component/DependencyInjection/SimpleXMLElement.php

+ 4 - 1
src/Symfony/Component/DependencyInjection/SimpleXMLElement.php

@@ -106,7 +106,10 @@ class SimpleXMLElement extends \SimpleXMLElement
             case 'null' === $lowercaseValue:
                 return null;
             case ctype_digit($value):
-                return '0' == $value[0] ? octdec($value) : intval($value);
+                $raw = $value;
+                $cast = intval($value);
+
+                return '0' == $value[0] ? octdec($value) : (((string) $raw == (string) $cast) ? $cast : $raw);
             case 'true' === $lowercaseValue:
                 return true;
             case 'false' === $lowercaseValue: