summaryrefslogtreecommitdiff
path: root/main/php_variables.c
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2016-05-05 14:49:08 +0200
committerJoe Watkins <krakjoe@php.net>2017-01-23 17:19:06 +0000
commitfd4025069d561b4196851c2e9a85b5bfdfe1465a (patch)
treef309186bf9c935c0f29446d87481f396f40efdea /main/php_variables.c
parent5c6bf3598a41d7acefe6a8adf592aedc50b4bf2d (diff)
downloadphp-git-fd4025069d561b4196851c2e9a85b5bfdfe1465a.tar.gz
Enable HT RC assertions with escape-hatch
HT functions that modify the array now assert that rc=1. As we don't respect this COW constraint everywhere, either for a good reason or because fixing it would take more work, we provide an escape hatch in the form of HT_ALLOW_COW_VIOLATION(ht). If this macro is called assertions on this ht are disabled. The macro is a no-op in release mode.
Diffstat (limited to 'main/php_variables.c')
-rw-r--r--main/php_variables.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/main/php_variables.c b/main/php_variables.c
index 9dd1860880..ff43466014 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -795,6 +795,11 @@ static zend_bool php_auto_globals_create_server(zend_string *name)
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_SERVER]);
Z_ADDREF(PG(http_globals)[TRACK_VARS_SERVER]);
+ /* TODO: TRACK_VARS_SERVER is modified in a number of places (e.g. phar) past this point,
+ * where rc>1 due to the $_SERVER global. Ideally this shouldn't happen, but for now we
+ * ignore this issue, as it would probably require larger changes. */
+ HT_ALLOW_COW_VIOLATION(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]));
+
return 0; /* don't rearm */
}