1
--- a/ext/standard/array.c
2
+++ b/ext/standard/array.c
3
@@ -1389,10 +1389,10 @@ PHP_FUNCTION(extract)
6
/* GLOBALS protection */
7
- if (var_exists && var_name_len == sizeof("GLOBALS") && !strcmp(var_name, "GLOBALS")) {
8
+ if (var_exists && var_name_len == sizeof("GLOBALS")-1 && !strcmp(var_name, "GLOBALS")) {
11
- if (var_exists && var_name_len == sizeof("this") && !strcmp(var_name, "this") && EG(scope) && EG(scope)->name_length != 0) {
12
+ if (var_exists && var_name_len == sizeof("this")-1 && !strcmp(var_name, "this") && EG(scope) && EG(scope)->name_length != 0) {
15
ZVAL_STRINGL(&final_name, var_name, var_name_len, 1);
17
+++ b/ext/standard/tests/array/extract_safety.phpt
20
+Test extract() for overwrite of GLOBALS
24
+debug_zval_dump($GLOBALS["str"]);
26
+/* Extracting Global Variables */
27
+$splat = array("foo" => "bar");
28
+var_dump(extract(array("GLOBALS" => $splat, EXTR_OVERWRITE)));
32
+debug_zval_dump($GLOBALS["str"]);
38
+string(4) "John" refcount(2)
40
+string(4) "John" refcount(2)
43
\ No newline at end of file