summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2008-12-09 19:17:11 +0000
committerJohannes Schlüter <johannes@php.net>2008-12-09 19:17:11 +0000
commitd828b8acc0403eed67bb73ea305581e319213555 (patch)
tree5311a6002f904c7824b221cb7e7afa7b7ae596c1 /Zend/zend_builtin_functions.c
parenta8578a5ab1bd78b553ca071aae95e25c441af24a (diff)
downloadphp-git-d828b8acc0403eed67bb73ea305581e319213555.tar.gz
MFH: Fix #46813 (class_exists doesn`t work with fully qualified namespace)
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 0a936ed7f4..3a35373f75 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1157,10 +1157,21 @@ ZEND_FUNCTION(class_exists)
}
if (!autoload) {
+ char *name;
+ int len;
+
lc_name = do_alloca(class_name_len + 1, use_heap);
zend_str_tolower_copy(lc_name, class_name, class_name_len);
+
+ /* Ignore leading "\" */
+ name = lc_name;
+ len = class_name_len;
+ if (lc_name[0] == '\\') {
+ name = &lc_name[1];
+ len--;
+ }
- found = zend_hash_find(EG(class_table), lc_name, class_name_len+1, (void **) &ce);
+ found = zend_hash_find(EG(class_table), name, len+1, (void **) &ce);
free_alloca(lc_name, use_heap);
RETURN_BOOL(found == SUCCESS && !((*ce)->ce_flags & ZEND_ACC_INTERFACE));
}