php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69359 provide a way to fetch the current environment variables
Submitted: 2015-04-02 20:36 UTC Modified: 2015-10-16 17:03 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: tyrael@php.net Assigned: tyrael
Status: Closed Package: Unknown/Other Function
PHP Version: master-Git-2015-04-02 (Git) OS:
Private report: No CVE-ID:
 [2015-04-02 20:36 UTC] tyrael@php.net
Description:
------------
$_ENV is only available when variables_order includes "E", some distros like ubuntu ship with a php.ini where E is not part of variables_order, and currently there is no clean way to fetch all of the environment vars if your script was executed that way.


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-02 21:04 UTC] tyrael@php.net
-Assigned To: +Assigned To: tyrael
 [2015-10-16 16:56 UTC] tyrael@php.net
-Summary: impelement environ() for fetching all environment vars +Summary: provide a way to fetch the current environment variables
 [2015-10-16 16:56 UTC] tyrael@php.net
after some discussion at the original Pull Request(1214) page, the consensus was that instead of adding a new method we should change getenv() so when called without arguments it should return with the environment variables as an array.

I also forget to mention another use-case for this feature request: even when $_ENV is populated it gets populated on startup/first access(depending on auto_globals_jit) and $_ENV won't reflect any environment changes after the initial population, which can be sometimes desired.
 [2015-10-16 17:03 UTC] tyrael@php.net
-Status: Assigned +Status: Closed
 [2015-10-16 17:03 UTC] tyrael@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

implemented it in master, expected to be released in php 7.1.0
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC