mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
- Add new test
This commit is contained in:
44
ext/standard/tests/array/bug29992.phpt
Executable file
44
ext/standard/tests/array/bug29992.phpt
Executable file
@@ -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===
|
||||
Reference in New Issue
Block a user