|  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
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: Assigned: tyrael (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: master-Git-2015-04-02 (Git) OS:
Private report: No CVE-ID: None
 [2015-04-02 20:36 UTC]
$_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.


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-02 21:04 UTC]
-Assigned To: +Assigned To: tyrael
 [2015-10-16 16:56 UTC]
-Summary: impelement environ() for fetching all environment vars +Summary: provide a way to fetch the current environment variables
 [2015-10-16 16:56 UTC]
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]
-Status: Assigned +Status: Closed
 [2015-10-16 17:03 UTC]
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

 For Windows:
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-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 05:01:33 2024 UTC