From: tomas_matousek at hotmail dot com
Operating system: WinXP
PHP version: 5.0.1
PHP Bug Type: Reproducible crash
Bug description: array_reduce crashes
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 bug report at http://bugs.php.net/?id=29954&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29954&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29954&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29954&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=29954&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29954&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29954&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29954&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29954&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29954&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29954&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29954&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29954&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29954&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29954&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29954&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29954&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29954&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29954&r=float