From: Anatol Belski Date: Fri, 31 Jul 2015 11:22:24 +0000 (+0200) Subject: Fixed bug #70108 sometimes empty $_SERVER['QUERY_STRING'] X-Git-Tag: php-7.0.0beta3~5^2~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b604716fb6fccfcbaafc8ecf46d1cf5ddb6c715c;p=php Fixed bug #70108 sometimes empty $_SERVER['QUERY_STRING'] 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. --- diff --git a/Zend/zend.c b/Zend/zend.c index 168658655c..b1290f76c1 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -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) {