php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14002 array_merge of subarrays deletes subarrays of unmerged data
Submitted: 2001-11-09 18:17 UTC Modified: 2001-11-16 13:12 UTC
From: aulbach at unter dot franken dot de Assigned:
Status: Closed Package: Arrays related
PHP Version: 4.0.4pl1 OS: unix
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
31 - 17 = ?
Subscribe to this entry?

 
 [2001-11-09 18:17 UTC] aulbach at unter dot franken dot 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);
    }
}

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-16 13:12 UTC] aulbach at unter dot franken dot de
Could just test it 4.0.6 and it works. :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 03:01:32 2024 UTC