summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2002-07-27 15:53:14 +0000
committerAndi Gutmans <andi@php.net>2002-07-27 15:53:14 +0000
commitb476ddf183aebfb32a4bb3f584c2749ff092635b (patch)
treee35185762ef6fa1d2ffc850852788be0a2714893
parentfbbeaec63038ec44cc2cebe4726019dec245e259 (diff)
downloadphp-git-b476ddf183aebfb32a4bb3f584c2749ff092635b.tar.gz
- Make sure classes are first looked for in the current scope.
- Make sure that during inheritance the global scope is searched if the - current one doesn't work.
-rw-r--r--Zend/zend_compile.c3
-rw-r--r--Zend/zend_execute_API.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index bf072219c2..cc70bab015 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2066,7 +2066,8 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod
CG(active_ce_parent_class_name).value.str.val = estrndup(parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len);
CG(active_ce_parent_class_name).value.str.len = parent_class_name->u.constant.value.str.len;
- if (zend_hash_find(CG(active_class_entry)?&CG(active_class_entry)->class_table:CG(class_table), parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len+1, (void **) &parent_class_p)==SUCCESS) {
+ if ((CG(active_class_entry) && (zend_hash_find(&CG(active_class_entry)->class_table, parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len+1, (void **) &parent_class_p) == SUCCESS)) ||
+ zend_hash_find(CG(class_table), parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len+1, (void **) &parent_class_p) == SUCCESS) {
parent_class = *parent_class_p;
/* copy functions */
zend_hash_copy(&new_class_entry->function_table, &parent_class->function_table, (copy_ctor_func_t) function_add_ref, &tmp_zend_function, sizeof(zend_function));
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index efa5cafee9..426379bc22 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -645,6 +645,11 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
zval *retval_ptr;
int retval;
+ if (EG(scope)) {
+ if (zend_hash_find(&EG(scope)->class_table, name, name_length+1, (void **) ce) == SUCCESS) {
+ return SUCCESS;
+ }
+ }
if (zend_hash_find(EG(class_table), name, name_length+1, (void **) ce) == SUCCESS) {
return SUCCESS;
}