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!
Ctype Funktionen
Inhaltsverzeichnis
- ctype_alnum — Auf alphanumerische Zeichen überprüfen
- ctype_alpha — Auf Buchstabe(n) überprüfen
- ctype_cntrl — Auf Steuerzeichen überprüfen
- ctype_digit — Auf Ziffern überprüfen
- ctype_graph — Auf druckbare Zeichen (außer Leerzeichen) überprüfen
- ctype_lower — Auf Kleinbuchstaben überprüfen
- ctype_print — Auf druckbare Zeichen überprüfen
- ctype_punct — Prüft auf Sonderzeichem, d.h. auf druckbare Zeichen die weder Buchstaben noch Ziffern noch Leerzeichen sind.
- ctype_space — Auf Leerzeichen überprüfen
- ctype_upper — Auf Großbuchstaben prüfen
- ctype_xdigit — Auf Hexadezimalziffern überprüfen
Ctype Funktionen
14-Oct-2006 05:44
avarab at gmail dot com
03-Jan-2006 10:58
03-Jan-2006 10:58
In case the ctype_*() functions aren't compiled in your PHP and you can't recompile for some reason (e.g. shared host) you can use the compatability functions from the MediaWiki project which use preg_* as a replacement[1], removing lines 2 and 3 in the source should make them suitable for usage elsewhere.
Shameless self-advertisement, but hey, we find them useful;)
1. A tinyurl because the submission script complained about long lines: http://tinyurl.com/7hz4l
1. The real url split up:
http://cvs.sourceforge.net/viewcvs.py/*checkout*/
wikipedia/phase3/includes/compatability/ctype.php
