summaryrefslogtreecommitdiff
path: root/Zend/zend.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-07-31 13:22:24 +0200
committerAnatol Belski <ab@php.net>2015-07-31 13:32:39 +0200
commitb604716fb6fccfcbaafc8ecf46d1cf5ddb6c715c (patch)
tree0d6e8ef2ed528bee6b534d1d5ec5276921c6ddc6 /Zend/zend.c
parent590c5a7e501bec91c4f57813d167e870653f2451 (diff)
downloadphp-git-b604716fb6fccfcbaafc8ecf46d1cf5ddb6c715c.tar.gz
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.
Diffstat (limited to 'Zend/zend.c')
-rw-r--r--Zend/zend.c14
1 files changed, 13 insertions, 1 deletions
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) {