summaryrefslogtreecommitdiff
path: root/ext/ctype
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2004-07-20 20:08:08 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2004-07-20 20:08:08 +0000
commitfbfd50bd1f9207767b9f39fd445b5e08aa81e0f0 (patch)
tree357805b122d45ab5ce9d1fdba63bd0ba10f556cd /ext/ctype
parente87fe59e9695412110ab22bc01c07d7155de01de (diff)
downloadphp-git-fbfd50bd1f9207767b9f39fd445b5e08aa81e0f0.tar.gz
- Correct range checks.
- Normalize negative values.
Diffstat (limited to 'ext/ctype')
-rw-r--r--ext/ctype/ctype.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c
index db88978eb5..b16324042d 100644
--- a/ext/ctype/ctype.c
+++ b/ext/ctype/ctype.c
@@ -97,9 +97,11 @@ PHP_MINFO_FUNCTION(ctype)
return; \
switch (Z_TYPE_P(c)) { \
case IS_LONG: \
- if (Z_LVAL_P(c) < 255 && Z_LVAL_P(c) > -127) { \
+ if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
- } \
+ } else if (Z_LVAL_P(c) >= -128) { \
+ RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
+ } \
SEPARATE_ZVAL(&c); \
convert_to_string(c); \
case IS_STRING: \