summaryrefslogtreecommitdiff
path: root/Zend/zend.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend.c')
-rw-r--r--Zend/zend.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index aed08ed5fd..f68e1efeb0 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -32,11 +32,13 @@
# define GLOBAL_CLASS_TABLE global_class_table
# define GLOBAL_CONSTANTS_TABLE global_constants_table
# define GLOBAL_AUTO_GLOBALS_TABLE global_auto_globals_table
+# define GLOBAL_NAMESPACES_TABLE global_namespaces_table
#else
# define GLOBAL_FUNCTION_TABLE CG(function_table)
# define GLOBAL_CLASS_TABLE CG(class_table)
# define GLOBAL_CONSTANTS_TABLE CG(zend_constants)
# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals)
+# define GLOBAL_NAMESPACES_TABLE CG(namespaces)
#endif
#if defined(ZEND_WIN32) && ZEND_DEBUG
@@ -424,9 +426,22 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable));
GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable));
GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));
+ GLOBAL_NAMESPACES_TABLE = (HashTable *) malloc(sizeof(HashTable));
zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, NULL, 1, 0);
+ zend_hash_init_ex(GLOBAL_NAMESPACES_TABLE, 8, NULL, NULL, 1, 0);
+
+ {
+ Namespace main_namespace;
+
+ main_namespace.type = INTERNAL_NAMESPACE;
+ main_namespace.class_table = GLOBAL_CLASS_TABLE;
+ main_namespace.function_table = GLOBAL_FUNCTION_TABLE;
+
+ zend_hash_update(GLOBAL_NAMESPACES_TABLE, "", sizeof(""), &main_namespace, sizeof(Namespace), NULL);
+ }
+
register_standard_class();
zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0);
zend_init_rsrc_list_dtors();
@@ -449,6 +464,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
compiler_globals->function_table = GLOBAL_FUNCTION_TABLE;
compiler_globals->class_table = GLOBAL_CLASS_TABLE;
compiler_globals->auto_globals = GLOBAL_AUTO_GLOBALS_TABLE;
+ compiler_globals->namespaces = GLOBAL_NAMESPACES_TABLE;
zend_startup_constants(tsrm_ls);
GLOBAL_CONSTANTS_TABLE = EG(zend_constants);
#else
@@ -495,6 +511,8 @@ void zend_shutdown(TSRMLS_D)
free(GLOBAL_CLASS_TABLE);
zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
free(GLOBAL_AUTO_GLOBALS_TABLE);
+ zend_hash_destroy(GLOBAL_NAMESPACES_TABLE);
+ free(GLOBAL_NAMESPACES_TABLE);
zend_shutdown_extensions(TSRMLS_C);
free(zend_version_info);
#ifndef ZTS