#29954 [Opn->Csd]: array_reduce crashes

From: Date: Sun, 28 Nov 2004 17:06:12 +0000
Subject: #29954 [Opn->Csd]: array_reduce crashes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-69570@lists.php.net to get a copy of this message
ID: 29954 Updated by: tony2001@php.net Reported By: tomas_matousek at hotmail dot com -Status: Open +Status: Closed Bug Type: Reproducible crash Operating System: WinXP PHP Version: 5.0.1 New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2004-09-02 16:56:44] tomas_matousek at hotmail dot com Errata: $array1 should be empty when printed out ------------------------------------------------------------------------ [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

« previous php.bugs (#69570) next »