Bug #80915 [NEW]: Taking a reference to $_SERVER hides it's values from phpinfo()

From: Date: Mon, 29 Mar 2021 17:25:48 +0000
Subject: Bug #80915 [NEW]: Taking a reference to $_SERVER hides it's values from phpinfo()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233046@lists.php.net to get a copy of this message
From:             donatj at gmail dot com
Operating system: All
PHP version:      8.0.3
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Taking a reference to $_SERVER hides it's values from phpinfo()

Description:
------------
$_SERVER disappeared from our admin phpinfo page, after a bit of poking
I figured 
out a middleware we're using takes a reference to $_SERVER.

It only reads, doesn't write to it at all - but it breaks phpinfo.

This can be seen in my given example code where simply:

$foo =& $_SERVER;

breaks phpinfo's variable output


Test script:
---------------
<?php

echo "---- Expected Output ----\n\n";

\phpinfo(INFO_VARIABLES);

echo "\n\n---- Actual Broken Output ----\n\n";

$foo =& $_SERVER;

\phpinfo(INFO_VARIABLES);

echo "\n\n---- Proof that \$_SERVER isn't broken ----\n\n";

print_r($_SERVER);


Expected result:
----------------
(truncated to relevant output)

phpinfo()

PHP Variables

Variable => Value
$_SERVER['TMPDIR'] => /var/folders/dr/cpm01_51333c1px2yzc8qr9xq1kth0/T/
$_SERVER['__CF_USER_TEXT_ENCODING'] => 0x6E196A00:0x0:0x0
$_SERVER['HOME'] => /Users/jdonat
$_SERVER['SHELL'] => /bin/zsh
$_SERVER['Apple_PubSub_Socket_Render'] =>
/private/tmp/com.apple.launchd.d1nNRxAouL/Render
$_SERVER['SSH_AUTH_SOCK'] =>
/private/tmp/com.apple.launchd.7DMDsXS1qP/Listeners
$_SERVER['PATH'] => /usr/bin:/bin:/usr/sbin:/sbin
$_SERVER['LOGNAME'] => jdonat
$_SERVER['DISPLAY'] =>
/private/tmp/com.apple.launchd.DHo7IG8khp/org.macosforge.xquartz:0
$_SERVER['XPC_SERVICE_NAME'] => com.electron.standard-otter.146872
$_SERVER['USER'] => jdonat
$_SERVER['XPC_FLAGS'] => 0x0
$_SERVER['PHP_SELF'] => -
$_SERVER['SCRIPT_NAME'] => -
$_SERVER['SCRIPT_FILENAME'] => 
$_SERVER['PATH_TRANSLATED'] => 
$_SERVER['DOCUMENT_ROOT'] => 
$_SERVER['REQUEST_TIME_FLOAT'] => 1617038447.9799
$_SERVER['REQUEST_TIME'] => 1617038447
$_SERVER['argv'] => Array
(
    [0] => -
)

$_SERVER['argc'] => 1

Actual result:
--------------
(truncated to relevant output)

phpinfo()

PHP Variables

Variable => Value

-- 
Edit bug report at https://bugs.php.net/bug.php?id=80915&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80915&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80915&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80915&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80915&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80915&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80915&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80915&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80915&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80915&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80915&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80915&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80915&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80915&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80915&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80915&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80915&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80915&r=mysqlcfg


Thread (6 messages)

« previous php.bugs (#233046) next »