ID:               41681
 User updated by:  rich at corephp dot co dot uk
 Reported By:      rich at corephp dot co dot uk
 Status:           Bogus
 Bug Type:         Filter related
 Operating System: Windows XP SP2
 PHP Version:      5.2.3
 Assigned To:      pajoye
 New Comment:

I understand that, in which case why does the "allow thousands" flag
work? One way or the other it is inconsistent. Either the bug is that
the allow thousands flag works, or the bug is that allow scientific
doesn't.


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

[2007-06-13 20:45:19] [EMAIL PROTECTED]

It is a flag for the sanitizing function not the validate filter, see
the main page of the filter manual function. 
(Not a bug > bogus)

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

[2007-06-13 18:31:26] rich at corephp dot co dot uk

Description:
------------
FILTER_VALIDATE_FLOAT doesn't allow for the use of
FILTER_FLAG_ALLOW_SCIENTIFIC as an option, although it DOES allow for
the use of FILTER_FLAG_ALLOW_THOUSAND.

As both are valid FILTER_SANITIZE_NUMBER_FLOAT flags, why not the same
for the validate float filter itself?

Reproduce code:
---------------
$val = '34,200';
$result = filter_var($val, FILTER_VALIDATE_FLOAT,
FILTER_FLAG_ALLOW_THOUSAND);
var_dump($val);
var_dump($result);

$val = 'e34200';
$result = filter_var($val, FILTER_VALIDATE_FLOAT,
FILTER_FLAG_ALLOW_SCIENTIFIC);
var_dump($val);
var_dump($result);


Expected result:
----------------
string(6) "34,200"
float(34200)

string(6) "e34200"
float(34200)


Actual result:
--------------
string(6) "34,200"
float(34200)

string(6) "e34200"
bool(false)



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


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

Reply via email to