ID: 18428
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Closed
-Bug Type: Strings related
+Bug Type: Documentation problem
Operating System: Linux
PHP Version: 4CVS-2002-07-19
New Comment:
an empty string is a string ;)
the documentation says:
" When called with a string argument they will check every character in
the string and will only return TRUE if every character in the string
matches the requested criteria. "
can't see the contradiction here as in an empty string every of the 0
charactetrs matches the criteriy ...
will add a note about that in the documentation,
but the behaviour will not change for backwards
compatibility reasons
Previous Comments:
------------------------------------------------------------------------
[2002-07-19 01:12:35] [EMAIL PROTECTED]
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; \
} \
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18428&edit=1
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php