- fixed zero precision bug git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21110 44c647ce-9c0f-0410-b52a-842ac1e357ba
@@ -270,6 +270,10 @@ class Zend_Locale_Format
if (strlen($pre) >= $options['precision']) {
$input = substr($input, 0, strlen($input) - strlen($pre) + $options['precision']);
}
+
+ if (($options['precision'] == 0) && ($input[strlen($input) - 1] == '.')) {
+ $input = substr($input, 0, -1);
+ }
return $input;
@@ -1074,4 +1074,12 @@ class Zend_Locale_FormatTest extends PHPUnit_Framework_TestCase
$options = array('locale' => 'de_AT');
$this->assertEquals('0,567', Zend_Locale_Format::toNumber(.567, $options));
+ /**
+ * @group ZF-9160
+ */
+ public function testGetNumberWithZeroPrecision()
+ {
+ $this->assertEquals(1234, Zend_Locale_Format::getNumber('1234.567', array('locale' => 'en_US', 'precision' => 0)));