]> granicus.if.org Git - php/commitdiff
Fix namespace issues
authorStanislav Malyshev <stas@php.net>
Fri, 4 Apr 2003 12:25:47 +0000 (12:25 +0000)
committerStanislav Malyshev <stas@php.net>
Fri, 4 Apr 2003 12:25:47 +0000 (12:25 +0000)
Zend/zend_API.c
Zend/zend_API.h

index eb1a5693963dee29387c1ec8d0bfdfa8efa01741..92769473adab777cf3afc88c41b0a52ae63efcc4 100644 (file)
@@ -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;
index 2181a483cfe127aa927bace535372912481d28d4..c3d487951c33b73727ed1a72f5a66208694441a2 100644 (file)
@@ -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)