Bug #74986 [NEW]: Environment variables set via putenv are not accessible via parse_ini_*
| From: | alan at aondra dot com | Date: | Tue, 25 Jul 2017 11:04:27 +0000 |
| Subject: | Bug #74986 [NEW]: Environment variables set via putenv are not accessible via parse_ini_* | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-210319@lists.php.net to get a copy of this message | ||
From: alan at aondra dot com
Operating system: Windows 7 Professional SP1 x64
PHP version: 7.1.7
Package: *General Issues
Bug Type: Bug
Bug description:Environment variables set via putenv are not accessible via parse_ini_*
Description:
------------
---
From manual page: http://www.php.net/function.parse-ini-file
---
In Windows environment, putenv does not make environment variables
accessible to either of the functions parse_ini_string or
parse_ini_file.
Sample on test site 3v4l.org works as expected, but fails in local
Windows development environment.
Apache HTTPD 2.4.27
PHP 7.1.7 x64 TS
Test script:
---------------
<?php
putenv('FOO=bar');
var_dump(getenv('FOO'));
$str = <<<'EOF'
BAZ=${FOO}
EOF;
$ini = parse_ini_string($str);
var_dump($ini);
Expected result:
----------------
string(3) "bar"
array(1) {
["BAZ"]=>
string(3) "bar"
}
Actual result:
--------------
string(3) "bar"
array(1) {
["BAZ"]=>
string(0) ""
}
--
Edit bug report at https://bugs.php.net/bug.php?id=74986&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74986&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74986&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74986&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74986&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74986&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74986&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74986&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74986&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74986&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74986&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74986&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74986&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74986&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74986&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74986&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74986&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74986&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74986&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74986&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74986&r=mysqlcfg