|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-19 06:01 UTC] hholzgra@php.net
[2002-07-19 09:03 UTC] busterb at mail dot utexas dot edu
[2002-07-19 11:58 UTC] hholzgra@php.net
[2002-07-19 12:34 UTC] busterb at mail dot utexas dot edu
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 23:00:01 2025 UTC |
The PHP ctype functions return TRUE when passed a zero length string. This is incorrect behavior; see the documentation for the contradiction. This is not an issue with the C ctype functions, since they deal with characters, which cannot be zero-length. The following patch corrects this behavior --- ctype.c 2002-07-18 23:58:02.000000000 -0500 +++ ctype_fixed.c 2002-07-18 23:57:48.000000000 -0500 @@ -102,8 +102,11 @@ { \ char *p; \ int n, len; \ - p=Z_STRVAL_P(c); \ len = Z_STRLEN_P(c); \ + if (!len) { \ + RETURN_FALSE; \ + } \ + p = Z_STRVAL_P(c); \ for(n=0;n<len;n++) { \ if(!iswhat(*p++)) RETURN_FALSE; \ } \