|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2020-02-10 16:05 UTC] cmb@php.net
-Status: Open
+Status: Verified
-Operating System: Windows
+Operating System: Windows ZTS
[2020-02-10 16:05 UTC] cmb@php.net
[2020-02-11 08:59 UTC] cmb@php.net
[2020-02-11 11:09 UTC] cmb@php.net
[2020-02-11 11:09 UTC] cmb@php.net
-Status: Verified
+Status: Closed
[2020-02-11 11:11 UTC] cmb@php.net
-Assigned To:
+Assigned To: cmb
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
Description: ------------ Calling `getenv()` without an argument does not reflect change made with `putenv`, but calling `getenv()` on a concrete variable *does*. The test script below produces the expected output on a Linux machine, but on my Windows machine the array difference is "array(0) { }". I'm using the out-of-the box configuration of php.ini-development. These are the first lines of `php -i` System => Windows NT MYPC 10.0 build 18363 (Windows 10) AMD64 Build Date => Jan 21 2020 17:46:05 Compiler => Visual C++ 2017 Architecture => x64 Configure Command => cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-pdo-oci=c:\php-snap-build\deps_aux\oracle\x64\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-snap-build\deps_aux\oracle\x64\instantclient_12_1\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--without-analyzer" "--with-pgo" Server API => Command Line Interface Virtual Directory Support => enabled Configuration File (php.ini) Path => C:\WINDOWS Loaded Configuration File => C:\xampp\php\php.ini Scan this dir for additional .ini files => (none) Additional .ini files parsed => (none) PHP API => 20190902 PHP Extension => 20190902 Zend Extension => 320190902 Zend Extension Build => API320190902,TS,VC15 PHP Extension Build => API20190902,TS,VC15 Debug Build => no Thread Safety => enabled Thread API => Windows Threads Zend Signal Handling => disabled Zend Memory Manager => enabled Zend Multibyte Support => disabled IPv6 Support => enabled DTrace Support => disabled Test script: --------------- <?php $old = getenv(); var_dump(getenv("FOO", true)); // expected: bool(false) putenv("FOO=BAR"); $new = getenv(); var_dump(array_diff($new, $old)); // expected: array(1){["FOO"]=>string(3) "BAR"} var_dump(getenv("FOO", true)); // expected: string(3) "BAR" ?> Expected result: ---------------- bool(false) array(1) { ["FOO"]=> string(3) "BAR" } string(3) "BAR" Actual result: -------------- bool(false) array(0) { } string(3) "BAR"