-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion failure for TRACK_VARS_SERVER #15905
Labels
Comments
cmb69
changed the title
Core dumped with
Assertion failure with Sep 16, 2024
-d "variables_order=E" -d "auto_globals_jit=0"
-d "variables_order=E" -d "auto_globals_jit=0"
Good finding, @YuanchengJiang! Relevant: Lines 902 to 905 in c65e042
However, with main/php_variables.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/main/php_variables.c b/main/php_variables.c
index c3b773516e..7569fd43e9 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -893,6 +893,7 @@ static bool php_auto_globals_create_server(zend_string *name)
} else {
zval_ptr_dtor_nogc(&PG(http_globals)[TRACK_VARS_SERVER]);
array_init(&PG(http_globals)[TRACK_VARS_SERVER]);
+ zend_hash_real_init_mixed(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]));
}
check_http_proxy(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])); |
cmb69
added a commit
to cmb69/php-src
that referenced
this issue
Sep 16, 2024
When the superglobals are eagerly initialized, but "S" is not contained in `variables_order`, `TRACK_VARS_SERVER` is created as empty array with refcount > 1. Since this hash table may later be modified, a flag is set which allows such COW violations for assertions. However, when `register_argc_argv` is on, the so far uninitialized hash table is updated with `argv`, what causes the hash table to be initialized, what drops the allow-COW-violations flag. The following update with `argc` then triggers a refcount violation assertion. Since we consider `HT_ALLOW_COW_VIOLATION` a hack, we do not want to keep the flag during hash table initialization, so we initialize the hash table right away after creation for this code path.
cmb69
changed the title
Assertion failure with
Assertion failure for TRACK_VARS_SERVER
Sep 16, 2024
-d "variables_order=E" -d "auto_globals_jit=0"
Fascinating! |
cmb69
added a commit
that referenced
this issue
Sep 26, 2024
* PHP-8.2: Fix GH-15905: Assertion failure for TRACK_VARS_SERVER
cmb69
added a commit
that referenced
this issue
Sep 26, 2024
* PHP-8.3: Fix GH-15905: Assertion failure for TRACK_VARS_SERVER
cmb69
added a commit
that referenced
this issue
Sep 26, 2024
* PHP-8.4: Fix GH-15905: Assertion failure for TRACK_VARS_SERVER
jorgsowa
pushed a commit
to jorgsowa/php-src
that referenced
this issue
Oct 1, 2024
When the superglobals are eagerly initialized, but "S" is not contained in `variables_order`, `TRACK_VARS_SERVER` is created as empty array with refcount > 1. Since this hash table may later be modified, a flag is set which allows such COW violations for assertions. However, when `register_argc_argv` is on, the so far uninitialized hash table is updated with `argv`, what causes the hash table to be initialized, what drops the allow-COW-violations flag. The following update with `argc` then triggers a refcount violation assertion. Since we consider `HT_ALLOW_COW_VIOLATION` a hack, we do not want to keep the flag during hash table initialization, so we initialize the hash table right away after creation for this code path. Closes phpGH-15930.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The following code:
To reproduce:
Resulted in this output:
PHP Version
PHP 8.4.0-dev
Operating System
ubuntu 22.04
The text was updated successfully, but these errors were encountered: