|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-08-05 00:52 UTC] jani@php.net
[2008-08-05 00:59 UTC] dragos at codersnest dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 08:00:02 2025 UTC |
Description: ------------ When passing an integer to ctype_digit, it will fail validating it. I tested several times, looks like this behaviour is consistent, I also tried using ctype_digit(65) which will also return "false". The PHP version is actually 5.1.6, running on Fedora 6 x86_64 with Apache 2.2.6 , all installed from the Fedora Repository. Same behaviour successfully reproduced with PHP 5.2.5 + Apache 2.0.54 on Suse9 x86_64. Possibly somewhere when the parameter passed is cast to a string, the value is somehow corrupted. Reproduce code: --------------- function getm($width, $height) { $errors = array(); if (!ctype_digit($width) || (int)$width <=0 ) { $errors[] = 'Width must be a positive integer value, ' . gettype($width) . ' passed'; } if (!ctype_digit($height) || (int)$height<=0 ) { $errors[] = 'Height must be a positive integer value, ' . gettype($height) . ' passed'; } return $errors; } $a = getm(48, 65); var_dump($a); Expected result: ---------------- array (0) {} Actual result: -------------- array(1) { [0]=> string(55) "Height must be a positive integer value, integer passed" }