|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-09-19 16:15 UTC] derick@php.net
[2017-09-20 08:31 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 09:00:01 2025 UTC |
Description: ------------ Someone defined octal numbers are prefixed with a 0 but there is no mathematical theory that says a number with one or more 0 in front is not a number. When we now use filter_var to filter user input we have to tell the user that a number with 0 in front is not an integer. Or we use a more generic way like reg exp /^\d+$/ but I thought the filter_var is made for this propose. Currently the problem is that users enter minutes and seconds with zeroes in front. It should indeed not be a float so to filter for integer is correct. Test script: --------------- var_dump(filter_var('03', FILTER_VALIDATE_INT)); var_dump(filter_var('+08', FILTER_VALIDATE_INT)); var_dump(filter_var('-010', FILTER_VALIDATE_INT)); Expected result: ---------------- int(3) int(8) int(-10) Actual result: -------------- false false false