Changes:
+ * fixed the "length" filter for numbers
* removed coupling between Twig_Node and Twig_Template
* fixed the ternary operator precedence rule
if (function_exists('mb_get_info')) {
function twig_length_filter(Twig_Environment $env, $thing)
{
- return is_string($thing) ? mb_strlen($thing, $env->getCharset()) : count($thing);
+ return is_scalar($thing) ? mb_strlen($thing, $env->getCharset()) : count($thing);
}
function twig_upper_filter(Twig_Environment $env, $string)
{
function twig_length_filter(Twig_Environment $env, $thing)
{
- return is_string($thing) ? strlen($thing) : count($thing);
+ return is_scalar($thing) ? strlen($thing) : count($thing);
}
function twig_title_string_filter(Twig_Environment $env, $string)
--TEMPLATE--
{{ array|length }}
{{ string|length }}
+{{ number|length }}
--DATA--
-return array('array' => array(1, 4), 'string' => 'foo')
+return array('array' => array(1, 4), 'string' => 'foo', 'number' => 1000)
--EXPECT--
2
3
+4