mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-11 01:46:37 +00:00
bug #2795 Fix float representation in compiled templates (fabpot)
This PR was merged into the 1.x branch.
Discussion
----------
Fix float representation in compiled templates
closes #2788
Commits
-------
e346c2ac fixed float representation in compiled templates
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
* switched generated code to use the PHP short array notation
|
||||
* dropped PHP 5.3 support
|
||||
* fixed float representation in compiled templates
|
||||
* added a second argument to the join filter (last separator configuration)
|
||||
|
||||
* 1.36.0 (2018-12-16)
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user