summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/extract_safety.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/array/extract_safety.phpt')
-rw-r--r--ext/standard/tests/array/extract_safety.phpt24
1 files changed, 24 insertions, 0 deletions
diff --git a/ext/standard/tests/array/extract_safety.phpt b/ext/standard/tests/array/extract_safety.phpt
new file mode 100644
index 0000000..d5d0763
--- /dev/null
+++ b/ext/standard/tests/array/extract_safety.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test extract() for overwrite of GLOBALS
+--FILE--
+<?php
+$str = "John";
+debug_zval_dump($GLOBALS["str"]);
+
+/* Extracting Global Variables */
+$splat = array("foo" => "bar");
+var_dump(extract(array("GLOBALS" => $splat, EXTR_OVERWRITE)));
+
+unset ($splat);
+
+debug_zval_dump($GLOBALS["str"]);
+
+echo "\nDone";
+?>
+
+--EXPECTF--
+string(4) "John" refcount(2)
+int(0)
+string(4) "John" refcount(2)
+
+Done \ No newline at end of file