Edit report at https://bugs.php.net/bug.php?id=43372&edit=1
ID: 43372
Comment by: kodafixed at gmail dot com
Reported by: gbml at bravogroup dot org
Summary: FILTER_VALIDATE_INT returns null for numbers with
leading zero(s)
Status: Not a bug
Type: Bug
Package: Filter related
Operating System: linux
PHP Version: 5.2.5
Assigned To: pajoye
Block user comment: N
Private report: N
New Comment:
FILTER_FLAG_ALLOW_OCTAL is not a feasible workaround for this issue.
echo filter_var('08', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_OCTAL) ? "OKAY" :
"NOT OKAY";
// RESULT: "NOT OKAY"
FILTER_FLAG_ALLOW_OCTAL completely invalidates tests where the value has a
leading 0 and includes an 8 or 9.
Previous Comments:
------------------------------------------------------------------------
[2007-11-22 11:13:09] [email protected]
See FILTER_FLAG_ALLOW_OCTAL.
------------------------------------------------------------------------
[2007-11-22 10:54:54] gbml at bravogroup dot org
Description:
------------
Filtering input numbers with leading zero(s) and filter FILTER_VALIDATE_INT
does not produce number
Reproduce code:
---------------
// $_POST ["size"] has value "002"
filter_input (INPUT_POST, "size", FILTER_VALIDATE_INT)
Expected result:
----------------
2
Actual result:
--------------
null
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=43372&edit=1