summaryrefslogtreecommitdiff
path: root/Zend/tests/foreach_016.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/foreach_016.phpt')
-rw-r--r--Zend/tests/foreach_016.phpt18
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/tests/foreach_016.phpt b/Zend/tests/foreach_016.phpt
new file mode 100644
index 0000000000..423c8dd0a6
--- /dev/null
+++ b/Zend/tests/foreach_016.phpt
@@ -0,0 +1,18 @@
+--TEST--
+array_unshift() function precerve foreach by reference iterator pointer
+--FILE--
+<?php
+$a = [1,2,3];
+foreach($a as &$v) {
+ echo "$v\n";
+ if ($v == 2) {
+ array_unshift($a, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+}
+var_dump(count($a));
+?>
+--EXPECT--
+1
+2
+3
+int(11)