From: rich at corephp dot co dot uk Operating system: Windows XP SP2 PHP version: 5.2.3 PHP Bug Type: Filter related Bug description: filter_validate_float doesn't allow scientific flag
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 bug report at http://bugs.php.net/?id=41681&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41681&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41681&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41681&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41681&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41681&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41681&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41681&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41681&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41681&r=support Expected behavior: http://bugs.php.net/fix.php?id=41681&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41681&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41681&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41681&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41681&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41681&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41681&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41681&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41681&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41681&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41681&r=mysqlcfg