note 70392 added to ref.ctype
| From: | php-general at lists dot php dot net | Date: | Sat, 14 Oct 2006 14:44:29 +0000 |
| Subject: | note 70392 added to ref.ctype | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118525@lists.php.net to get a copy of this message | ||
In PHP versions before 4.4.1, ctype functions have a bug handling very large integers.
http://bugs.php.net/bug.php?id=34645
See Crimson's comment under ctype_digit, or this test code from the bug:
<?php
$id = 394829384;
var_dump($id);
ctype_digit($id);
var_dump($id);
?>
Expected result:
----------------
int(394829384)
int(394829384)
Actual result:
--------------
int(394829384)
NULL
The fix is to cast it as a string:
<?php
ctype_digit((string)$id);
?>
... or use a current version of PHP!
----
Server IP: 64.71.164.2
Probable Submitter: 65.40.218.92
----
Manual Page -- http://www.php.net/manual/en/ref.ctype.php
Edit -- https://master.php.net/note/edit/70392
Del: integrated -- https://master.php.net/note/delete/70392/integrated
Del: useless -- https://master.php.net/note/delete/70392/useless
Del: bad code -- https://master.php.net/note/delete/70392/bad+code
Del: spam -- https://master.php.net/note/delete/70392/spam
Del: non-english -- https://master.php.net/note/delete/70392/non-english
Del: in docs -- https://master.php.net/note/delete/70392/in+docs
Del: other reasons-- https://master.php.net/note/delete/70392
Reject -- https://master.php.net/note/reject/70392
Search -- https://master.php.net/manage/user-notes.php