Bug #14128 Updated: array_merge_recursive modifies the first argument
| From: | yohgaki@php.net | Date: | Wed, 27 Feb 2002 02:43:45 +0000 |
| Subject: | Bug #14128 Updated: array_merge_recursive modifies the first argument | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-1144@lists.php.net to get a copy of this message | ||
ID: 14128
Updated by: yohgaki@php.net
Reported By: petert@tebault.org
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Windows NT 4.0 build 1381
PHP Version: 4.0.6
New Comment:
The version of PHP that this bug was reported in is too old. Please
try to reproduce this bug in the latest version of PHP (available
from http://www.php.net/downloads.php
If you are still able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Previous Comments:
------------------------------------------------------------------------
[2001-11-19 19:01:36] petert@tebault.org
<?php
// bug report:
// note that $query gets modified by the call to
// array_merge_recursive. This should not be.
//
//
//include('../include/util.inc.php');
function dump_array ($array) {
// doc
// String = dump_array(Array)
// returns a long string containing the array, expanded into a
// nested unordered list.
//statements
if(is_array($array)) {
echo "<ul>";
while(list($key,$val) = each($array)) {
echo "<li>$key => ";
if(is_array($val)) {
echo "$val";
dump_array($val);
} else {
echo "$val";
}
}
echo "</ul>";
} else {
if($array != "") {
echo "<li>[String] = $array";
} else {
echo "<li>Err: No values passed.";
}
}
};
/*
addquery
example input #1
*/
$query =
array("select" => array(
0 => "count(*) as 'cases opened'"
),
"from" => array(
0 => "table_case"
),
"where" => array(
0 => "table_case.creation_time between '%datestart%' and
'%dateend%'"
)
);
/*
example input #2
*/
$option =
array("select" => array(
0 => "table_bus_org.name"
),
"from" => array(
0 => "table_site",
1 => "table_bus_org"
),
"where" => array(
0 => "table_site.objid = table_case.case_reporter2site",
1 => "table_bus_org.objid = table_site.primary2bus_org",
2 => "table_bus_org.objid > 0"
),
"group by" => array(
0 => "table_bus_org.name"
),
"order by" => array(
0 => "count(*)"
)
);
/*
example output
$newquery =
array("select" => array(
0 => "table_bus_org.name",
1 => "count(*) as 'cases opened'"
),
"from" => array(
0 => "table_case",
1 => "table_site",
2 => "table_bus_org"
),
"where" => array(
0 => "table_case.creation_time between '%datestart%' and
'%dateend%'",
1 => "table_site.objid = table_case.case_reporter2site",
2 => "table_bus_org.objid = table_site.primary2bus_org",
3 => "table_bus_org.objid > 0"
),
"group by" => array(
0 => "table_bus_org.name",
),
"order by" => array(
0 => "count(*)",
)
);
*/
dump_array($query);
$newquery = array_merge_recursive($query,$option);
dump_array($query);
//dump_array($option);
//dump_array($newquery);
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=14128&edit=1