summaryrefslogtreecommitdiff
path: root/Zend/tests/array_add_indirect.phpt
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-10-12 11:03:39 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-10-12 11:24:27 +0200
commite304468e57692d4dfcf283346dd67c3e418e1934 (patch)
treeb24776763b6ba0aadeac5248273f4a392cd19da0 /Zend/tests/array_add_indirect.phpt
parent1ed5a2a54dc8ff61c276f0dc8d0e9808a835c169 (diff)
downloadphp-git-e304468e57692d4dfcf283346dd67c3e418e1934.tar.gz
Deindirect source elements in zend_hash_merge
If the RHS has INDIRECT elements, we do not those to be added to the LHS verbatim. As we're using UPDATE_INDIRECT, we might even create a nested INDIRECT that way. This is a side-quest of oss-fuzz #26245.
Diffstat (limited to 'Zend/tests/array_add_indirect.phpt')
-rw-r--r--Zend/tests/array_add_indirect.phpt16
1 files changed, 16 insertions, 0 deletions
diff --git a/Zend/tests/array_add_indirect.phpt b/Zend/tests/array_add_indirect.phpt
new file mode 100644
index 0000000000..821cc475b9
--- /dev/null
+++ b/Zend/tests/array_add_indirect.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Array addition should not add INDIRECT elements
+--FILE--
+<?php
+
+$x = 1;
+$ary = ['y' => 1];
+$ary += $GLOBALS;
+var_dump($ary['x']);
+$x = 2;
+var_dump($ary['x']);
+
+?>
+--EXPECT--
+int(1)
+int(1)