From 6ed305945dc118d683bc477d0fe1b6f3562d9a3f Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Fri, 4 Apr 2003 12:25:47 +0000 Subject: [PATCH] Fix namespace issues --- Zend/zend_API.c | 14 +++++++++----- Zend/zend_API.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index eb1a569396..92769473ad 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1147,6 +1147,7 @@ int zend_register_functions(zend_class_entry *scope, zend_function_entry *functi zend_function *ctor = NULL, *dtor = NULL, *clone = NULL; char *lowercase_name; int fname_len; + zend_namespace *scope_namespace; if (type==MODULE_PERSISTENT) { error_type = E_CORE_WARNING; @@ -1158,6 +1159,12 @@ int zend_register_functions(zend_class_entry *scope, zend_function_entry *functi target_function_table = CG(function_table); } internal_function->type = ZEND_INTERNAL_FUNCTION; + + if(scope) { + scope_namespace = scope->ns; + } else { + scope_namespace = EG(active_namespace); + } while (ptr->fname) { internal_function->handler = ptr->handler; @@ -1165,11 +1172,7 @@ int zend_register_functions(zend_class_entry *scope, zend_function_entry *functi internal_function->function_name = ptr->fname; internal_function->scope = scope; internal_function->fn_flags = ZEND_ACC_PUBLIC; - if (!scope) { - internal_function->ns = EG(active_namespace); - } else { - internal_function->ns = NULL; - } + internal_function->ns = scope_namespace; internal_function->prototype = NULL; if (!internal_function->handler) { zend_error(error_type, "Null function defined as active function"); @@ -1412,6 +1415,7 @@ ZEND_API zend_class_entry *zend_register_internal_class_in_ns(zend_class_entry * orig_class_table = CG(class_table); CG(class_table) = &ns->class_table; } + class_entry->ns = ns; register_class = zend_register_internal_class_ex(class_entry, parent_ce, NULL TSRMLS_CC); if (restore_orig) { EG(active_namespace) = orig_namespace; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 2181a483cf..c3d487951c 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -99,6 +99,7 @@ BEGIN_EXTERN_C() class_container.__call = handle_fcall; \ class_container.__get = handle_propget; \ class_container.__set = handle_propset; \ + class_container.num_interfaces = 0; \ } #define INIT_NAMESPACE(ns_container, ns_name) INIT_CLASS_ENTRY(ns_container, ns_name, NULL) -- 2.50.1