#24198 [Ver]: array_merge_recurcive

From: Date: Mon, 16 Jun 2003 08:55:40 +0000
Subject: #24198 [Ver]: array_merge_recurcive
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-42013@lists.php.net to get a copy of this message
ID: 24198 User updated by: camka at email dot ee Reported By: camka at email dot ee Status: Verified Bug Type: Zend Engine 2 problem Operating System: win 2000 PHP Version: 4.3.3-dev/5.0.0-dev New Comment: just in case ... the same warning appears when trying to merge one array with itself array_merge_recursive($a,$a) Previous Comments: ------------------------------------------------------------------------ [2003-06-16 02:05:11] derick@php.net Could verfiy this on both 4.3.2, 4.3.3-dev and 5.0.0-dev ------------------------------------------------------------------------ [2003-06-16 01:43:28] camka at email dot ee Description: ------------ When var_dumping $f it appears a notice message, saying Warning: array_merge_recursive(): recursion detected in ... It is kind of strange because as far as I expect it is supposed to be the same result as in the line where $e is being var_dumped. var_dump($e) gives correct result: array 'a' => array 0 => 'aa' 1 => 'aa' 'b' => array 0 => 'bb' 1 => 'bb' and var_dump($f) gives notece message and result is array 'a' => 'aa' 'b' => 'bb' problem appears in 4.3.1 too, but not in 4.2.2 Reproduce code: --------------- <?php $c=array('a' => 'aa','b' => 'bb'); $d=array('a' => 'aa','b' => 'bb'); $a=$c; $b=$c; $f=array_merge_recursive($a,$b); var_dump($f); $e=array_merge_recursive($c,$d); var_dump($e); ?> Expected result: ---------------- array 'a' => array 0 => 'aa' 1 => 'aa' 'b' => array 0 => 'bb' 1 => 'bb' array 'a' => array 0 => 'aa' 1 => 'aa' 'b' => array 0 => 'bb' 1 => 'bb' Actual result: -------------- Warning: array_merge_recursive(): recursion detected in c:\servak\www\tests\array_merge_recursive.php on line 9 array 'a' => 'aa' 'b' => 'bb' array 'a' => array 0 => 'aa' 1 => 'aa' 'b' => array 0 => 'bb' 1 => 'bb' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24198&edit=1

« previous php.bugs (#42013) next »