Merge branch 'PHP-8.0'

* PHP-8.0:
  Handle reference zvals when outputting superglobals in phpinfo()

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
This commit is contained in:
Christoph M. Becker 2021-03-30 13:54:05 +02:00
commit 90da9bf53b
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6
2 changed files with 21 additions and 1 deletions

View file

@ -173,7 +173,7 @@ static ZEND_COLD void php_print_gpcse_array(char *name, uint32_t name_length)
key = zend_string_init(name, name_length, 0);
zend_is_auto_global(key);
if ((data = zend_hash_find(&EG(symbol_table), key)) != NULL && (Z_TYPE_P(data) == IS_ARRAY)) {
if ((data = zend_hash_find_deref(&EG(symbol_table), key)) != NULL && (Z_TYPE_P(data) == IS_ARRAY)) {
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(data), num_key, string_key, tmp) {
if (!sapi_module.phpinfo_as_text) {
php_info_print("<tr>");

View file

@ -0,0 +1,20 @@
--TEST--
Bug #80915: Taking a reference to $_SERVER hides its values from phpinfo()
--FILE--
<?php
$_ENV = [];
$_SERVER = [ 'test' => 'test' ];
$reference =& $_SERVER;
phpinfo(INFO_VARIABLES);
?>
--EXPECT--
phpinfo()
PHP Variables
Variable => Value
$_SERVER['test'] => test