summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.c
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2008-11-25 21:14:23 +0000
committerFelipe Pena <felipe@php.net>2008-11-25 21:14:23 +0000
commit8f32490ca38b32692b9993a2bbf1e5e599cc95f8 (patch)
tree5d36194a95522c1f68da00503d68dfa2d6787659 /Zend/zend_execute_API.c
parentea45b713c8ed4110e26588fab00730a677106231 (diff)
downloadphp-git-8f32490ca38b32692b9993a2bbf1e5e599cc95f8.tar.gz
- Fixed bug #46665 (Triggering autoload with a variable classname causes truncated autoload param)
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r--Zend/zend_execute_API.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 222e3147db..ed6dc162a1 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1006,7 +1006,7 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, int use_aut
zval autoload_function;
zval *class_name_ptr;
zval *retval_ptr = NULL;
- int retval;
+ int retval, lc_length;
char *lc_name;
char *lc_free;
zend_fcall_info fcall_info;
@@ -1020,13 +1020,14 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, int use_aut
lc_free = lc_name = do_alloca(name_length + 1, use_heap);
zend_str_tolower_copy(lc_name, name, name_length);
+ lc_length = name_length + 1;
if (lc_name[0] == '\\') {
lc_name += 1;
- name_length -= 1;
+ lc_length -= 1;
}
- if (zend_hash_find(EG(class_table), lc_name, name_length + 1, (void **) ce) == SUCCESS) {
+ if (zend_hash_find(EG(class_table), lc_name, lc_length, (void **) ce) == SUCCESS) {
free_alloca(lc_free, use_heap);
return SUCCESS;
}
@@ -1044,7 +1045,7 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, int use_aut
zend_hash_init(EG(in_autoload), 0, NULL, NULL, 0);
}
- if (zend_hash_add(EG(in_autoload), lc_name, name_length + 1, (void**)&dummy, sizeof(char), NULL) == FAILURE) {
+ if (zend_hash_add(EG(in_autoload), lc_name, lc_length, (void**)&dummy, sizeof(char), NULL) == FAILURE) {
free_alloca(lc_free, use_heap);
return FAILURE;
}
@@ -1081,7 +1082,7 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, int use_aut
zval_ptr_dtor(&class_name_ptr);
- zend_hash_del(EG(in_autoload), lc_name, name_length + 1);
+ zend_hash_del(EG(in_autoload), lc_name, lc_length);
if (retval_ptr) {
zval_ptr_dtor(&retval_ptr);
@@ -1092,7 +1093,7 @@ ZEND_API int zend_lookup_class_ex(const char *name, int name_length, int use_aut
return FAILURE;
}
- retval = zend_hash_find(EG(class_table), lc_name, name_length + 1, (void **) ce);
+ retval = zend_hash_find(EG(class_table), lc_name, lc_length, (void **) ce);
free_alloca(lc_free, use_heap);
return retval;
}