-
Notifications
You must be signed in to change notification settings - Fork 805
Zend_Locale_Format::toNumber() fails with setlocale(LC_ALL, 'de_DE') #514
Comments
Please recheck with PHPs NumberFormatter class: $fmt = new NumberFormatter('de_DE', NumberFormatter::DECIMAL);
$this->assertEquals('3,2', $fmt->format(3.2)); |
The test is successfull with the NumberFormatter assertion. |
This is a good reason to refactor your application. |
Excuse me, how is this related to my application? I'm just extending the original ZF1 unit tests with the provided test case completely independant of my application. |
You should use the |
OK, then there was a misunderstanding obviously ;). |
The current consideration is to mark Btw. Thanks for reporting! |
I am not sure what causes this issue, as I am not able to reproduce it on every machine I have.
To test it I extended zf1/tests/Zend/Locale/FormatTest.php with the following code:
I am var_dumping the float to see if setlocale settings are active, it should output
float(3,3)
when everything i correct.Unfortunately I get:
I ran this test with phpunit 4.5.0, PHP 5.3.26 on debian wheezy Linux dev 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux
I read about this problem on the internet, but none of the developers was ever able to reproduce it.
The exact same test is running successfully on my Mac with phpunit 4.5.0, PHP 5.4.24, Darwin mac 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
There is one difference in the output of
localeconv()
though:Debian
Mac:
There is no thousands separator defined on the mac! If I set the locale on the debian machine to
it_IT
the test runs succesfully with the following output forlocaleconv
:On the mac
it_IT
results in the following forlocaleconv
:and runs successfully too, even though there is a thousands separator set.
Any help is appreciated, tell me if you need more information. Using Zend Framework 1.12.11, it also fails on 1.12.3
The text was updated successfully, but these errors were encountered: