1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 01:18:19 +02:00
Files
archived-php-src/ext/standard/tests/general_functions/bug79254.phpt
T
Christoph M. Becker 7b464ce6f3 Fix #79254: getenv() w/o arguments not showing changes
To be able to see changes done only with `SetEnvironmentVariable()`, we
have to use `GetEnvironmentStrings()` instead of `environ`, because the
latter sees only changes done with `putenv()`.

For best backward compatibility we're using `GetEnvironmentStringsA()`;
switching to the wide string version likely makes sense for master,
though.
2020-02-11 11:47:29 +01:00

23 lines
358 B
PHP

--TEST--
Bug #79254 (getenv() w/o arguments not showing changes)
--FILE--
<?php
$old = getenv();
var_dump(getenv("PHP_BUG_79254", true));
putenv("PHP_BUG_79254=BAR");
$new = getenv();
var_dump(array_diff($new, $old));
var_dump(getenv("PHP_BUG_79254", true));
?>
--EXPECT--
bool(false)
array(1) {
["PHP_BUG_79254"]=>
string(3) "BAR"
}
string(3) "BAR"