summaryrefslogtreecommitdiff
path: root/ext/standard/tests/general_functions
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-02-11 09:43:15 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-02-11 11:47:29 +0100
commit7b464ce6f3feb94dc5b897e4f8792a39e07710b6 (patch)
treef026459593d58bc7894a7a333d5a90ff914b0787 /ext/standard/tests/general_functions
parentf649adedfe3f0797cd0d6248e1b01c65b326f443 (diff)
downloadphp-git-7b464ce6f3feb94dc5b897e4f8792a39e07710b6.tar.gz
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.
Diffstat (limited to 'ext/standard/tests/general_functions')
-rw-r--r--ext/standard/tests/general_functions/bug79254.phpt22
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/standard/tests/general_functions/bug79254.phpt b/ext/standard/tests/general_functions/bug79254.phpt
new file mode 100644
index 0000000000..d2b86aa606
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug79254.phpt
@@ -0,0 +1,22 @@
+--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"