ZF-11610: ctype_digit in Zend Framework
Description
ctype_digit has a very strange behavior in php. In most cases variable should be manualy cast to string.
$someVarIntOrNumericString;
//$isDigit = ctype_digit($someVarIntOrNumericString); //<= wrong
$isDigit = ctype_digit((string) $someVarIntOrNumericString); //right
Examples:
ctype_digits('123'); //true
ctype_digits(123); //false
// but ...
ctype_digits(ord('5')); //true
In ZF there are some places where cast to string is missing: * Zend_Feed_Writer_Entry::setDateCreated() * Zend_Feed_Writer_Entry::setDateModified() * Zend_Gdata_App_Util::formatTimestamp() * ..etc
Comments
Posted by Adam Lundrigan (adamlundrigan) on 2012-02-25T21:18:21.000+0000
Locations where {{ctype_digits}} is used w/o string cast and the result of my checks:
Posted by Adam Lundrigan (adamlundrigan) on 2012-02-25T22:06:45.000+0000
Fixed in trunk r24641, r24642, r24643, r24644, r24645, r24646, r24647 Merged to release-1.11 in r24648