Bug #77782 [NEW]: getenv without params returns keys that aren't accessible with $varname param

From: Date: Fri, 22 Mar 2019 20:52:46 +0000
Subject: Bug #77782 [NEW]: getenv without params returns keys that aren't accessible with $varname param
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220135@lists.php.net to get a copy of this message
From: matt at mattallan dot me Operating system: macOs Mojave 10.14 PHP version: 7.3.3 Package: FPM related Bug Type: Bug Bug description:getenv without params returns keys that aren't accessible with $varname param Description: ------------ PHP version: PHP 7.3.3 (cli) (built: Mar 8 2019 16:40:07) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.3, Copyright (c) 1999-2018, by Zend Technologies (installed with Homebrew) Relevant ini params: variables_order = "EGPCS" auto_globals_jit = Off Overview: I set the environment variable FOO using the fastcgi_param in my Nginx configuration. If I make a HTTP request to the server I am able to access the environment variable using getenv()['FOO'] but I am not able to access the environment variable using getenv('FOO'). The same issue occurs with the Caddy server. If I set the environment variable in the fpm configuration using env[FOO]=bar the issue does not occur. If I run the script from the CLI or the built in web server it works as expected. Test script: --------------- <?php $env = getenv(); var_dump(array_key_exists('FOO', $env)); var_dump($env['FOO']); var_dump(getenv('FOO')); Expected result: ---------------- I expect to see the output: bool(true) string(3) "bar" string(3) "bar" Actual result: -------------- I see the output: bool(true) string(3) "bar" bool(false) -- Edit bug report at https://bugs.php.net/bug.php?id=77782&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77782&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77782&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77782&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77782&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77782&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77782&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77782&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77782&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77782&r=support Expected behavior: https://bugs.php.net/fix.php?id=77782&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77782&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77782&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77782&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77782&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77782&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77782&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77782&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77782&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77782&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77782&r=mysqlcfg

« previous php.bugs (#220135) next »