#23158 [NEW]: a new digit checker
| From: | melkor at dance dot student dot utwente dot nl | Date: | Thu, 10 Apr 2003 22:31:15 +0000 |
| Subject: | #23158 [NEW]: a new digit checker | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-37539@lists.php.net to get a copy of this message | ||
From: melkor at dance dot student dot utwente dot nl
Operating system: linux
PHP version: 5CVS-2003-04-10 (dev)
PHP Bug Type: Feature/Change Request
Bug description: a new digit checker
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 bug report at http://bugs.php.net/?id=23158&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23158&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23158&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23158&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23158&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23158&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23158&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23158&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23158&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23158&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23158&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23158&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23158&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23158&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23158&r=gnused