Skip to content

Commit 90da9bf

Browse files
committed
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>
2 parents 849ae12 + 4434781 commit 90da9bf

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

ext/standard/info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static ZEND_COLD void php_print_gpcse_array(char *name, uint32_t name_length)
173173
key = zend_string_init(name, name_length, 0);
174174
zend_is_auto_global(key);
175175

176-
if ((data = zend_hash_find(&EG(symbol_table), key)) != NULL && (Z_TYPE_P(data) == IS_ARRAY)) {
176+
if ((data = zend_hash_find_deref(&EG(symbol_table), key)) != NULL && (Z_TYPE_P(data) == IS_ARRAY)) {
177177
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(data), num_key, string_key, tmp) {
178178
if (!sapi_module.phpinfo_as_text) {
179179
php_info_print("<tr>");

ext/standard/tests/bug80915.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #80915: Taking a reference to $_SERVER hides its values from phpinfo()
3+
--FILE--
4+
<?php
5+
6+
$_ENV = [];
7+
$_SERVER = [ 'test' => 'test' ];
8+
9+
$reference =& $_SERVER;
10+
11+
phpinfo(INFO_VARIABLES);
12+
13+
?>
14+
--EXPECT--
15+
phpinfo()
16+
17+
PHP Variables
18+
19+
Variable => Value
20+
$_SERVER['test'] => test

0 commit comments

Comments
 (0)