From 78de59d0b3bf8e9994ee317cdc14c57b67f4f48b Mon Sep 17 00:00:00 2001 From: Tomasz Kowalczyk Date: Mon, 12 Aug 2013 21:25:17 +0200 Subject: [PATCH] Support binary notation. --- src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php | 1 + src/Symfony/Component/Config/Util/XmlUtils.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php index feb796b68f..4aa6ebe8fc 100644 --- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -127,6 +127,7 @@ class XmlUtilsTest extends \PHPUnit_Framework_TestCase array('111,222,333,444', '111,222,333,444'), array('1111,2222,3333,4444,5555', '1111,2222,3333,4444,5555'), array('foo', 'foo'), + array(6, '0b0110'), ); } } diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index 2e9d86ec21..edb1f6b0a8 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -191,6 +191,8 @@ class XmlUtils return true; case 'false' === $lowercaseValue: return false; + case strlen($value) > 2 && '0b' == $value[0].$value[1]: + return bindec($value); case is_numeric($value): return '0x' == $value[0].$value[1] ? hexdec($value) : floatval($value); case preg_match('/^(-|\+)?[0-9]+(\.[0-9]+)?$/', $value):