summaryrefslogtreecommitdiff
path: root/Zend/tests/bug72543.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/bug72543.phpt')
-rw-r--r--Zend/tests/bug72543.phpt39
1 files changed, 39 insertions, 0 deletions
diff --git a/Zend/tests/bug72543.phpt b/Zend/tests/bug72543.phpt
new file mode 100644
index 0000000000..4244b8ce41
--- /dev/null
+++ b/Zend/tests/bug72543.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Bug #72543 (different references behavior comparing to PHP 5)
+--FILE--
+<?php
+function create_references(&$array) {
+ foreach ($array as $key => $value) {
+ create_references($array[$key]);
+ }
+}
+
+function change_copy($copy) {
+ $copy['b']['z']['z'] = $copy['b'];
+}
+
+$data = [
+ 'a' => [
+ 'b' => [],
+ ],
+];
+
+create_references($data);
+
+$copy = $data['a'];
+var_dump($copy);
+
+change_copy($copy);
+var_dump($copy); //RECURSION
+?>
+--EXPECT--
+array(1) {
+ ["b"]=>
+ array(0) {
+ }
+}
+array(1) {
+ ["b"]=>
+ array(0) {
+ }
+}