Browse Source
Fixed bug #61730 (Segfault from array_walk modifying an array passed by reference)
pull/90/head
Fixed bug #61730 (Segfault from array_walk modifying an array passed by reference)
pull/90/head
3 changed files with 44 additions and 7 deletions
@ -0,0 +1,37 @@ |
|||
--TEST-- |
|||
Bug #61730 (Segfault from array_walk modifying an array passed by reference) |
|||
--FILE-- |
|||
<?php |
|||
$myArray = array_fill(0, 10, 1); |
|||
|
|||
array_walk( |
|||
$myArray, |
|||
function($value, $key) use ($myArray) |
|||
{ |
|||
reset($myArray); |
|||
} |
|||
); |
|||
|
|||
array_walk( |
|||
$myArray, |
|||
function($value, $key) use (&$myArray) |
|||
{ |
|||
var_dump($key); |
|||
unset($myArray[$key]); |
|||
unset($myArray[$key+1]); |
|||
unset($myArray[$key+2]); |
|||
} |
|||
); |
|||
|
|||
|
|||
|
|||
print_r($myArray); |
|||
--EXPECT-- |
|||
int(0) |
|||
int(4) |
|||
int(8) |
|||
Array |
|||
( |
|||
[3] => 1 |
|||
[7] => 1 |
|||
) |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue