From e587fa8a858bf194f4b5a3e86564c973a9e11008 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 13 Aug 2013 15:40:07 +0200 Subject: [PATCH] [Config] fixed an edge case --- src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php | 1 + src/Symfony/Component/Config/Util/XmlUtils.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php index 4ab1e70ecc..a17119260a 100644 --- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -104,6 +104,7 @@ class XmlUtilsTest extends \PHPUnit_Framework_TestCase public function getDataForPhpize() { return array( + array('', ''), array(null, 'null'), array(true, 'true'), array(false, 'false'), diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index ef614501c5..3f96bd8f0e 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -187,7 +187,7 @@ class XmlUtils $cast = intval($value); return '0' == $value[0] ? octdec($value) : (((string) $raw == (string) $cast) ? $cast : $raw); - case '-' === $value[0] && ctype_digit(substr($value, 1)): + case isset($value[1]) && '-' === $value[0] && ctype_digit(substr($value, 1)): $raw = $value; $cast = intval($value);