ZF-2700: Zend_Validate_Float might error with localeconv

Issue Type: Bug Created: 2008-02-21T08:03:51.000+0000 Last Updated: 2008-03-21T16:25:41.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Paul Menheere (paulmenheere) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate

Related issues: Attachments:


in Zend_Validate_Float de lines (64-65):

$valueFiltered = str_replace($locale['decimal_point'], '.', $valueString); $valueFiltered = str_replace($locale['thousands_sep'], '', $valueFiltered);

should be replaced by :

$valueFiltered = str_replace( array( $locale['decimal_point'], $locale['thousands_sep']), array( '.', '' ), $valueString );

Otherwise for example the dutch locale : 1.000.000,00 would transform to 100000000 instead of 1000000.00


Posted by Thomas Weidner (thomas) on 2008-03-09T15:07:45.000+0000

Not quite right... the solution is simpler.

I don't know why this code was duplicated because it exists already in Zend_Locale. But to get the right normalised value you have first to delete the thousand seperators and at last change the decimal point.

Or you could simply use Zend_Locale_Math::normalize();

I changed the two lines and it should now work with the existing solution and without any new feature.

Posted by Thomas Weidner (thomas) on 2008-03-09T15:08:20.000+0000

Fixed with SVN-8714

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.