fixed float representation in compiled templates

This commit is contained in:
Fabien Potencier
2019-01-08 08:53:15 +01:00
parent 22bc325859
commit e346c2accf
3 changed files with 16 additions and 1 deletions
+1
View File
@@ -1,5 +1,6 @@
* 1.36.1 (2018-XX-XX)
* fixed float representation in compiled templates
* added a second argument to the join filter (last separator configuration)
* 1.36.0 (2018-12-16)
+1 -1
View File
@@ -175,7 +175,7 @@ class Twig_Compiler implements Twig_CompilerInterface
setlocale(LC_NUMERIC, 'C');
}
$this->raw($value);
$this->raw(var_export($value, true));
if (false !== $locale) {
setlocale(LC_NUMERIC, $locale);
@@ -0,0 +1,14 @@
--TEST--
Twig compiles floats properly
--TEMPLATE--
{% set val2 = 0.0 %}
{{ val is same as (0.0) ? 'Yes' : 'No' }}
{{ val2 is same as (0.0) ? 'Yes' : 'No' }}
{{ val is same as (val2) ? 'Yes' : 'No' }}
--DATA--
return array('val' => 0.0)
--EXPECT--
Yes
Yes
Yes