ID:               39158
 Updated by:       [EMAIL PROTECTED]
 Reported By:      andiesPostfach at web dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         Filter related
 Operating System: Suse Linux 9.3
 PHP Version:      5.2.0RC5
 New Comment:

Both "." and "," are allowed if you didn't specify your own.
This is expected behaviour. 


Previous Comments:
------------------------------------------------------------------------

[2006-10-14 10:32:11] andiesPostfach at web dot de

Description:
------------
FILTER_VALIDATE_FLOAT should use the decimal point info from the given
locale. In my case (in Germany) it should use ','.


Reproduce code:
---------------
  $loc_de = setlocale(LC_ALL, '[EMAIL PROTECTED]', 'de_DE', 'deu_deu');
  echo "Preferred locale for german on this system is '$loc_de'";

  $locale_info = localeconv();
  print_r($locale_info);
  
  // This should work an give 0,27
  $value = "0,27";
  echo "Value is: ".filter_var( $value, FILTER_VALIDATE_FLOAT );
  
  // This shouldn't work but it gives 0,27
  $value = "0.27";
  echo "Value is: ".filter_var( $value, FILTER_VALIDATE_FLOAT );
  

Expected result:
----------------
Preferred locale for german on this system is '[EMAIL PROTECTED]'Array
(
    [decimal_point] => ,
    [thousands_sep] => .
    [int_curr_symbol] => EUR 
    [currency_symbol] => €
    [mon_decimal_point] => ,
    [mon_thousands_sep] => .
    [positive_sign] => 
    [negative_sign] => -
    [int_frac_digits] => 2
    [frac_digits] => 2
    [p_cs_precedes] => 0
    [p_sep_by_space] => 1
    [n_cs_precedes] => 0
    [n_sep_by_space] => 1
    [p_sign_posn] => 1
    [n_sign_posn] => 1
    [grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

    [mon_grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

)
Value for 0,27 is: 0,27<br />
Value for 0.27 is: <br />

Actual result:
--------------
Preferred locale for german on this system is '[EMAIL PROTECTED]'Array
(
    [decimal_point] => ,
    [thousands_sep] => .
    [int_curr_symbol] => EUR 
    [currency_symbol] => €
    [mon_decimal_point] => ,
    [mon_thousands_sep] => .
    [positive_sign] => 
    [negative_sign] => -
    [int_frac_digits] => 2
    [frac_digits] => 2
    [p_cs_precedes] => 0
    [p_sep_by_space] => 1
    [n_cs_precedes] => 0
    [n_sep_by_space] => 1
    [p_sign_posn] => 1
    [n_sign_posn] => 1
    [grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

    [mon_grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

)
Value for 0,27 is: <br />
Value for 0.27 is: 0,27<br />


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39158&edit=1

Reply via email to