Browse Source

Fix namespace issues

migration/unlabaled-1.3.2
Stanislav Malyshev 23 years ago
parent
commit
6ed305945d
  1. 14
      Zend/zend_API.c
  2. 1
      Zend/zend_API.h

14
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;

1
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)

Loading…
Cancel
Save