|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67808 Env variables through the built-in server set in $_ENV but not in $_SERVER
Submitted: 2014-08-08 20:42 UTC Modified: 2015-09-05 12:11 UTC
Avg. Score:4.2 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:2 (50.0%)
From: morgan dot auchede at gmail dot com Assigned: cmb (profile)
Status: Wont fix Package: Built-in web server
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: morgan dot auchede at gmail dot com
New email:
PHP Version: OS:


 [2014-08-08 20:42 UTC] morgan dot auchede at gmail dot com
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:

Test script:
# test.php

# bash
export FOO="bar"
php -d variables_order=EGPCS -S -t . test.php

Expected result:
string 'bar' (length=3)
string 'bar' (length=3)

Actual result:
string 'bar' (length=3)
Notice: Undefined index: FOO


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-08 20:50 UTC]
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.
 [2015-09-05 12:11 UTC]
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2015-09-05 12:11 UTC]
I agree with Adam's assessment, so WONTFIX.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Oct 01 19:01:24 2023 UTC