summaryrefslogtreecommitdiff
path: root/Zend/tests/bug76800.phpt
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-09-14 10:28:31 +0300
committerDmitry Stogov <dmitry@zend.com>2018-09-14 10:28:31 +0300
commit3bc4a63fc27768c665fcbc101db4e579c761833b (patch)
tree394446c0b89de7d2f64b297574ee16369165a060 /Zend/tests/bug76800.phpt
parent83685b52588ed62217abc07dec6b048ba580f137 (diff)
downloadphp-git-3bc4a63fc27768c665fcbc101db4e579c761833b.tar.gz
Fixed bug #76800 (foreach inconsistent if array modified during loop)
Diffstat (limited to 'Zend/tests/bug76800.phpt')
-rw-r--r--Zend/tests/bug76800.phpt13
1 files changed, 13 insertions, 0 deletions
diff --git a/Zend/tests/bug76800.phpt b/Zend/tests/bug76800.phpt
new file mode 100644
index 0000000000..d7f6d8070b
--- /dev/null
+++ b/Zend/tests/bug76800.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #76800 (foreach inconsistent if array modified during loop)
+--FILE--
+<?php
+$arr = [1 => 1, 3 => 3]; // [1 => 1, 2 => 3] will print both keys
+foreach($arr as $key => &$val) { // without & will print both keys
+ echo "See key {$key}\n";
+ $arr[0] = 0; // without this line will print both keys
+ unset($arr[0]);
+}
+--EXPECT--
+See key 1
+See key 3