Bug #77783 [NEW]: getenv affected by auto_globals_jit in fpm-fcgi SAPI

From: Date: Fri, 22 Mar 2019 21:41:46 +0000
Subject: Bug #77783 [NEW]: getenv affected by auto_globals_jit in fpm-fcgi SAPI
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220136@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:          *Configuration Issues
Bug Type:         Bug
Bug description:getenv affected by auto_globals_jit in fpm-fcgi SAPI

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"
}

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



Thread (5 messages)

« previous php.bugs (#220136) next »