From:             [EMAIL PROTECTED]
Operating system: unix
PHP version:      4.0.4pl1
PHP Bug Type:     Arrays related
Bug description:  array_merge of subarrays deletes subarrays of unmerged data

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 bug report at: http://bugs.php.net/?id=14002&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to