Bug #67808 [Opn]: Env variables through the built-in server set in $_ENV but not in $_SERVER
| From: | aharvey@php.net | Date: | Fri, 08 Aug 2014 20:50:52 +0000 |
| Subject: | Bug #67808 [Opn]: Env variables through the built-in server set in $_ENV but not in $_SERVER | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187039@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67808&edit=1
ID: 67808
Updated by: aharvey@php.net
Reported by: morgan dot auchede at gmail dot com
Summary: Env variables through the built-in server set in
$_ENV but not in $_SERVER
Status: Open
Type: Bug
Package: Built-in web server
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Honestly, my initial reaction to this is that CGI and FPM are wrong â I wouldn't
support changing them (BC and all), but I don't think we need to be bug for bug compatible on
the $_SERVER copying behaviour across SAPIs, either, given the documented method for accessing
environment variables ($_ENV) works fine in all SAPIs in current versions.
Not won't fixing this now in case someone else wants to weigh in, but that's my
inclination.
Previous Comments:
------------------------------------------------------------------------
[2014-08-08 20:42:16] morgan dot auchede at gmail dot com
Description:
------------
If we set an environment variable through Apache (or Nginx), the variable will be available in
"$_ENV" and "$_SERVER".
Unfortunately, if we set an environment variable through the built-in server, the variable will only
be available in "$_ENV" (not in $_SERVER).
See the original issue related: https://github.com/symfony/symfony/issues/10208
Test script:
---------------
# test.php
<?php
var_dump($_ENV['FOO']);
var_dump($_SERVER['FOO']);
# bash
export FOO="bar"
php -d variables_order=EGPCS -S 0.0.0.0:8000 -t . test.php
Expected result:
----------------
string 'bar' (length=3)
string 'bar' (length=3)
Actual result:
--------------
string 'bar' (length=3)
Notice: Undefined index: FOO
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67808&edit=1