Bug #14002 Updated: array_merge of subarrays deletes subarrays of unmerged data
| From: | aulbach at unter dot franken dot de | Date: | Fri, 16 Nov 2001 18:12:45 +0000 |
| Subject: | Bug #14002 Updated: array_merge of subarrays deletes subarrays of unmerged data | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-70675@lists.php.net to get a copy of this message | ||
ID: 14002
User updated by: aulbach@unter.franken.de
Reported By: aulbach@unter.franken.de
Old Status: Open
Status: Closed
Bug Type: Arrays related
Operating System: unix
PHP Version: 4.0.4pl1
New Comment:
Could just test it 4.0.6 and it works. :)
Previous Comments:
------------------------------------------------------------------------
[2001-11-09 18:17:30] aulbach@unter.franken.de
Example script is also @ http://dev0.fidion.de/ssilk/test/err_array_merge.php
This behavior takes me now 2 hours... Perhaps it is fixed with 4.0.6? Sorry, no testing machine
available.
<?php
$a=array(
'ERROR' => array(
'tags in text-text' => array(
'err' => 'tags',
'type'=> 'nachts'
),
'range-ax-Erscheinungsdatum' => array(
'err' => 'bla',
'type' => 'blubb'
)
),
'WARN' => array(
'ax-Anzeigenextra' => array(
'err' => 'hugo',
'type' => 'sex'
)
)
);
echo "<pre>";
echo "BUG:\n";
foreach ($a as $key => $val) {
if ( empty($this->totalerrs[$key]) ) {
$totalerrs[$key]=array();
}
foreach ( $val as $k => $v) {
print_r($v);
$totalerrs[$key]=
array_merge($totalerrs[$key],$val);
}
}
echo "\n\nFIX:\n";
foreach ($a as $key => $val) {
if ( empty($this->totalerrs[$key]) ) {
$totalerrs[$key]=array();
}
$x=$val;
foreach ( $val as $k => $v) {
print_r($v);
$totalerrs[$key]=
array_merge($totalerrs[$key],$x);
}
}
?>
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14002&edit=1