Return to bug61730.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Bug #61730 (Segfault from array_walk modifying an array passed by reference) 3: --FILE-- 4: <?php 5: $myArray = array_fill(0, 10, 1); 6: 7: array_walk( 8: $myArray, 9: function($value, $key) use ($myArray) 10: { 11: reset($myArray); 12: } 13: ); 14: 15: array_walk( 16: $myArray, 17: function($value, $key) use (&$myArray) 18: { 19: var_dump($key); 20: unset($myArray[$key]); 21: unset($myArray[$key+1]); 22: unset($myArray[$key+2]); 23: } 24: ); 25: 26: 27: 28: print_r($myArray); 29: --EXPECT-- 30: int(0) 31: int(4) 32: int(8) 33: Array 34: ( 35: [3] => 1 36: [7] => 1 37: )