merged branch thunderer/config-support-binary-notation (PR #8727)
This PR was submitted for the 2.2 branch but it was merged into the master branch instead (closes #8727). Discussion ---------- [Config] Support binary notation. This PR addresses issue #8066 . Binary notation is not caught by `is_numeric()` function so we need to implement it on our own. Commits ------- 34f5bd8 [Config] Support binary notation.
This commit is contained in:
commit
494fe74b7e
@ -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'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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):
|
||||
|
Reference in New Issue
Block a user