]> granicus.if.org Git - php/commitdiff
This commit was manufactured by cvs2svn to create branch 'PHP_5_0'.
authorSVN Migration <svn@php.net>
Mon, 4 Oct 2004 17:53:56 +0000 (17:53 +0000)
committerSVN Migration <svn@php.net>
Mon, 4 Oct 2004 17:53:56 +0000 (17:53 +0000)
ext/standard/tests/array/bug29992.phpt [new file with mode: 0755]

diff --git a/ext/standard/tests/array/bug29992.phpt b/ext/standard/tests/array/bug29992.phpt
new file mode 100755 (executable)
index 0000000..74be291
--- /dev/null
@@ -0,0 +1,44 @@
+--TEST--
+Bug #29992 (foreach by reference corrupts the array)
+--FILE--
+<?php
+
+$array = array(1,2,3);
+
+print_r($array);
+
+foreach($array as $item) var_dump($item);
+foreach($array as &$item) var_dump($item);
+foreach($array as &$item) var_dump($item);
+foreach($array as $item) var_dump($item);
+
+print_r($array);
+
+?>
+===DONE===
+--EXPECT--
+Array
+(
+    [0] => 1
+    [1] => 2
+    [2] => 3
+)
+int(1)
+int(2)
+int(3)
+int(1)
+int(2)
+int(3)
+int(1)
+int(2)
+int(3)
+int(1)
+int(2)
+int(3)
+Array
+(
+    [0] => 1
+    [1] => 2
+    [2] => 3
+)
+===DONE===