|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-03-23 03:43 UTC] danack@php.net
-Status: Open
+Status: Not a bug
[2019-03-23 03:43 UTC] danack@php.net
[2019-03-23 03:43 UTC] danack@php.net
-Status: Not a bug
+Status: Duplicate
[2019-03-26 14:38 UTC] matt at mattallan dot me
[2019-03-28 10:32 UTC] danack@php.net
-Status: Duplicate
+Status: Open
[2019-03-28 10:32 UTC] danack@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 19:00:01 2025 UTC |
Description: ------------ If the auto_globals_jit directive is enabled the getenv function does not return all of the environment variables. The test script below must be executed with the fpm sapi. I personally tested this with both Nginx and Caddy + php-fpm. It doesn't seem If you access a superglobal anywhere in the script (even after the getenv call), the environment variables are loaded as expected. The value of the fpm directive clear_env does not seem to matter. 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 = On Test script: --------------- <?php var_dump(getenv()); // Uncomment this and the environment variables are returned above // $whatever = $_ENV['SOMETHING'] ?? false; Expected result: ---------------- When I execute `curl localhost` I see the output: array(28) { ["USER"]=> string(4) "matt" ["HOME"]=> string(11) "/Users/matt" ["HTTP_CONNECTION"]=> string(10) "keep-alive" ["HTTP_ACCEPT"]=> string(3) "*/*" ["HTTP_ACCEPT_ENCODING"]=> string(13) "gzip, deflate" ["HTTP_USER_AGENT"]=> string(12) "HTTPie/0.9.9" // lots more keys .... } Actual result: -------------- When I execute `curl localhost` I see the output: array(2) { ["USER"]=> string(4) "matt" ["HOME"]=> string(11) "/Users/matt" }