ID: 20381
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Verified
Bug Type: Arrays related
Operating System: SuSE Linux 7.3
PHP Version: 4.3.0-dev
New Comment:
They're actually mangled with CVS HEAD too..somehow I missed that or
had those print_r() lines in wrong place. :I
Previous Comments:
------------------------------------------------------------------------
[2002-11-12 07:16:46] [EMAIL PROTECTED]
In 4.3.2 the source arrays are mangled even when you don't add them to
the result.
This was just for a nicer, smaller example.
Example
========
// Same $a and $b as before
$result = array_merge_recursive( $a, $b );
print_r( $c );
print_r( $a );
print_r( $b );
// have sadly the same effect
------------------------------------------------------------------------
[2002-11-12 06:33:56] [EMAIL PROTECTED]
Reproduced using latest CVS. The original arrays are fine, but when
they're added to the resulting array, then they get mangled.
------------------------------------------------------------------------
[2002-11-11 23:04:18] [EMAIL PROTECTED]
Similar to #14990 (exept that the demo code there runs fine) and the
first source array gets mangled.
Example
=========
<pre><?
$a = array(
'a1' => 1,
'a2' => array( 1, 2, 3 ),
'a3' => array(
'a' => array( 10, 20, 30 ),
'b' => 'b'
)
);
$b = array( 'a1' => 2,
'a2' => array( 3, 4, 5 ),
'a3' => array(
'c' => 'cc',
'a' => array( 10, 40 )
)
);
$c['result'] = array_merge_recursive( $a, $b );
$c['a'] = $a;
$c['b'] = $b;
print_r( $c );
?>
Example Output
================
Array
(
[result] => Array
(
[a1] => Array
(
[0] => 1
[1] => 2
)
[a2] => Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 3
[4] => 4
[5] => 5
)
[a3] => Array
(
[a] => Array
(
[0] => 10
[1] => 20
[2] => 30
[3] => 10
[4] => 40
)
[b] => b
[c] => cc
)
)
[a] => Array
(
[a1] => 1
[a2] => Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 3
[4] => 4
[5] => 5
)
[a3] => Array
(
[a] => Array
(
[0] => 10
[1] => 20
[2] => 30
[3] => 10
[4] => 40
)
[b] => b
[c] => cc
)
)
[b] => Array
(
[a1] => 2
[a2] => Array
(
[0] => 3
[1] => 4
[2] => 5
)
[a3] => Array
(
[c] => cc
[a] => Array
(
[0] => 10
[1] => 40
)
)
)
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20381&edit=1