diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2004-11-30 16:55:55 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2004-11-30 16:55:55 +0000 |
commit | 349c134061c8936f3caec52073b691f9a8196d5b (patch) | |
tree | 600ed0ffaef1e2897b082d8279652159c3cdd903 /ext/ctype | |
parent | 5f949d21c20a9e5debe91843318f82c0b379b400 (diff) | |
download | php-git-349c134061c8936f3caec52073b691f9a8196d5b.tar.gz |
Fixed bug #30945 (make ctype_* functions return FALSE on empty strings).
Slight performance improvement of multi-byte string checking via ctype_*.
Diffstat (limited to 'ext/ctype')
-rw-r--r-- | ext/ctype/ctype.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c index 78f6d293e3..834ace200b 100644 --- a/ext/ctype/ctype.c +++ b/ext/ctype/ctype.c @@ -106,11 +106,11 @@ PHP_MINFO_FUNCTION(ctype) convert_to_string(c); \ case IS_STRING: \ { \ - char *p; \ - int n, len; \ - p=Z_STRVAL_P(c); \ - len = Z_STRLEN_P(c); \ - for(n=0;n<len;n++) { \ + char *p = Z_STRVAL_P(c), *e = Z_STRVAL_P(c) + Z_STRLEN_P(c); \ + if (e == p) { \ + RETURN_FALSE; \ + } \ + while (p < e) { \ if(!iswhat((int)*(unsigned char *)(p++))) RETURN_FALSE; \ } \ RETURN_TRUE; \ |