Skip to content

testReverseTransformDisallowsNaN2 fails on arm64 with ICU 63 #29321

@mwhudson

Description

@mwhudson

Symfony version(s) affected: 3.4.18

Description
both tests called testReverseTransformDisallowsNaN2 (i.e. the one in IntegerToLocalizedStringTransformerTest.php and the one in NumberToLocalizedStringTransformerTest.php) failed in the Ubuntu autopkgtests on arm64 when we upgraded to ICU 63, for example see this log: https://objectstorage.prodstack4-5.canonical.com/v1/AUTH_77e2ada1e7a84929a74ba3b87153c0ac/autopkgtest-disco/disco/arm64/s/symfony/20181123_092647_26adc@/log.gz

How to reproduce
Run the tests on arm64 with ICU 63, e.g in a lxd container for disco.

Possible Solution
I've applied this patch in Ubuntu:

--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
@@ -146,7 +146,7 @@
             return;
         }
 
-        if ('NaN' === $value) {
+        if ('nan' === strtolower($value)) {
             throw new TransformationFailedException('"NaN" is not a valid number');
         }

Additional context
I've reported the change in behaviour as an ICU bug too: https://unicode-org.atlassian.net/browse/ICU-20285 but until ICU documents the intended behaviour of special values, something along the lines of my patch is probably a good idea?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions