ZF-9698: CLONE - Precision and number_format seems to be broken


I've noticed when bcmath extension is enabled the problem with broken precision and number_format reoccurs.

$number = Zend_Locale_Format::toNumber(13547.3678,
                                       array('precision' => 2,
                                             'locale' => $locale));

returns 13547.36 with bcmath enabled. Zend Server 5.0, ZF 1.10.2, PHP 5.2.12, Windows 7. Correct output should be 13547.37.


Closing as not reproduceable

Using the given code with locale 'de' and var_dump of the returned output I get

string '13.547,37' (length=9)

Using 'fr' I get:

string '13 547,37' (length=10)

Both results are correct.

Thomas, have you turned bcmath extension on? This simple script is not working for me with bcmath enabled.

require 'Zend/Loader/Autoloader.php';
var_dump(Zend_Locale_Format::toNumber(13547.3678,array('precision' => 2,'locale' => new Zend_Locale('en_US'))));


string(9) "13,547.36"

Please turn on bcmath extension to reproduce problem!

Using your code I get

boolean true
string '13,547.37' (length=9)

Note that I am running my tests on Windows where bcmath is enabled per default.

I've upgraded to ZF 1.10.3 and problem disappears. (but was still present on 1.10.2 :)) Thanks for your willingness anyway.