Issue Type: Bug Created: 2011-11-09T18:35:38.000+0000 Last Updated: 2011-11-09T20:51:06.000+0000 Status: Open Fix version(s): Reporter: Eric Hokanson (pceric) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale
Related issues: Attachments:
In Zend_Locale_Format the precision option seems to be broken for some locales. Here is an example in German:
echo Zend_Locale_Format::toNumber(53.3333333333333333333) returns 53,3333333333333333333
which is correct but
echo Zend_Locale_Format::toNumber(53.3333333333333333333, array('precision' => 1)) returns 533.333.333.333.330,0
which isn't even close.
This is seen on PHP 5.3.8 with BCMath enabled and ZF 1.11.11.
Posted by Eric Hokanson (pceric) on 2011-11-09T19:10:20.000+0000
Drilling down a bit further it appears to be an interaction between PHP's setlocale() and ZF. Since we are in the process of migrating code from one to the other we are currently making use of both. It looks as if Zend_Locale_Format should be made aware of setlocale()'s settings.
Posted by Eric Hokanson (pceric) on 2011-11-09T20:18:59.000+0000
After some team debugging the issue is the overuse of Zend_Locale_Math::normalize in toNumber. The first use is fine and handles the setlocale() case but then it is called over and over during the execution of toNumber. After the first call it strips the wrong decimal_point/thousands_sep and butchers the number resulting in the wrong output.
Have you found an issue?
See the Overview section for more details.