Skip to content

Fix compiled float literals depending on the serialize_precision ini setting - #4988

Open
nicolas-grekas wants to merge 1 commit into
twigphp:3.xfrom
nicolas-grekas:repr-serialize-precision
Open

nicolas-grekas wants to merge 1 commit into
twigphp:3.xfrom
nicolas-grekas:repr-serialize-precision

Conversation

@nicolas-grekas

Copy link
Copy Markdown
Contributor

Compiler::repr() writes floats with var_export(), which follows the serialize_precision ini setting. With serialize_precision=17, 0.1 compiles to 0.10000000000000001, so two servers configured differently compile the same template to different code. This pins the setting to -1 while dumping a float, the same way the numeric locale is already pinned.

Found while checking that two builds of the same Symfony app give the same cache files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants