]> granicus.if.org Git - php/commitdiff
Fixed bug #70108 sometimes empty $_SERVER['QUERY_STRING']
authorAnatol Belski <ab@php.net>
Fri, 31 Jul 2015 11:22:24 +0000 (13:22 +0200)
committerAnatol Belski <ab@php.net>
Fri, 31 Jul 2015 11:32:39 +0000 (13:32 +0200)
auto_globals_jit is the reason every thread needs a copy. Otherwise
every thread will operate on the master values which can't end good.

Zend/zend.c

index 168658655c1a3135b5b1a9ee8440204c8e38fbda..b1290f76c12948cffadbb204c1891dd35ef74e01 100644 (file)
@@ -455,6 +455,18 @@ static void function_copy_ctor(zval *zv)
        function_add_ref(Z_FUNC_P(zv));
 }
 
+static void auto_global_copy_ctor(zval *zv)
+{
+       zend_auto_global *old_ag = (zend_auto_global *) Z_PTR_P(zv);
+       zend_auto_global *new_ag = pemalloc(sizeof(zend_auto_global), 1);
+
+       new_ag->name = zend_string_copy(old_ag->name);
+       new_ag->auto_global_callback = old_ag->auto_global_callback;
+       new_ag->jit = old_ag->jit;
+
+       Z_PTR_P(zv) = new_ag;
+}
+
 static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) /* {{{ */
 {
        compiler_globals->compiled_filename = NULL;
@@ -471,7 +483,7 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) /* {{
 
        compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
        zend_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0);
-       zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL /* empty element */);
+       zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, auto_global_copy_ctor);
 
        compiler_globals->last_static_member = zend_hash_num_elements(compiler_globals->class_table);
        if (compiler_globals->last_static_member) {