summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-10-04 17:53:55 +0000
committerMarcus Boerger <helly@php.net>2004-10-04 17:53:55 +0000
commitbb77132391aaeb07daa0e057ea5c11cdb151dfda (patch)
treea714c430bcce8fc2bb36f33284995d0e3e1ff562
parentdc2d342b24e74867c561d31c9d85c3d09a458366 (diff)
downloadphp-git-bb77132391aaeb07daa0e057ea5c11cdb151dfda.tar.gz
- Add new test
-rwxr-xr-xext/standard/tests/array/bug29992.phpt44
1 files changed, 44 insertions, 0 deletions
diff --git a/ext/standard/tests/array/bug29992.phpt b/ext/standard/tests/array/bug29992.phpt
new file mode 100755
index 0000000000..74be291891
--- /dev/null
+++ b/ext/standard/tests/array/bug29992.phpt
@@ -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===