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

 ID:                 23158
 Updated by:         [email protected]
 Reported by:        melkor at dance dot student dot utwente dot nl
 Summary:            a new digit checker
-Status:             Open
+Status:             Bogus
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   linux
 PHP Version:        5CVS-2003-04-10 (dev)
 Block user comment: N
 Private report:     N

 New Comment:

See above.


Previous Comments:
------------------------------------------------------------------------
[2007-12-31 22:49:29] michael at chunkycow dot com dot au

This is bogus, ctype_digit(4500) returns true.

------------------------------------------------------------------------
[2003-04-10 17:31:15] melkor at dance dot student dot utwente dot nl

For ID's in databases, a simple is_digit($mixed) check would be nice.



is_numeric($mixed) also accepts 1.0E10 and such values, which are not
valid for integer database IDs.



ctype_digit($string) returns false for any integer it gets, because
ctype_digit(4500) gets translated to isdigit(4500) which of course is
not a valid ascii character at all.



This might seem a little far fetched, but lots and lots of code uses
is_numeric checks where they should not. I do this too, because
otherwise I need 2 checks (is_integer($var) || ctype_digit($var)).. 

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



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

Reply via email to