ID: 29954
User updated by: tomas_matousek at hotmail dot com
Reported By: tomas_matousek at hotmail dot com
Status: Open
Bug Type: Reproducible crash
Operating System: WinXP
PHP Version: 5.0.1
New Comment:
Errata:
$array1 should be empty when printed out
Previous Comments:
------------------------------------------------------------------------
[2004-09-02 16:24:48] tomas_matousek at hotmail dot com
Description:
------------
array_reduce function crashes PHP in the following case
Reproduce code:
---------------
function &t(&$a, &$b)
{
static $o = 1;
$a[$b] = $o;
$b = $o;
$o++;
return $a;
}
$array0 = array("a", "b", "c", "d", "e");
$array1 = array();
print_r(array_reduce($array0,"t",$array1));
print_r($array0);
print_r($array1);
Expected result:
----------------
Array
(
[a] => 1
[b] => 2
[c] => 3
[d] => 4
[e] => 5
)
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
)
Array
(
[a] => 1
[b] => 2
[c] => 3
[d] => 4
[e] => 5
)
Actual result:
--------------
crash
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29954&edit=1