note 70392 deleted from ref.ctype by danbrown
| From: | danbrown@php.net | Date: | Sun, 15 Mar 2009 15:01:04 +0000 |
| Subject: | note 70392 deleted from ref.ctype by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151969@lists.php.net to get a copy of this message | ||
Note Submitter:
----
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!