Zend Framework

Zend_Validate_Float might error with localeconv

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.3
  • Fix Version/s: 1.5.0
  • Component/s: Zend_Validate
  • Labels:
    None
  • Fix Version Priority:
    Should Have

Description

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

Activity

Hide
Thomas Weidner added a comment -

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.

Show
Thomas Weidner added a comment - 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.
Hide
Thomas Weidner added a comment -

Fixed with SVN-8714

Show
Thomas Weidner added a comment - Fixed with SVN-8714

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
3m
Original Estimate - 3 minutes
Remaining:
3m
Remaining Estimate - 3 minutes
Logged:
Not Specified
Time Spent - Not Specified