bug #1410787, incorrect merging of parameters contained in an array

This commit is contained in:
Marc Delisle
2006-01-22 19:22:17 +00:00
parent 412680d078
commit 2edb509535
2 changed files with 13 additions and 1 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2006-01-22 Marc Delisle <lem9@users.sourceforge.net>
* libraries/common.lib.php: bug #1410787, incorrect merging of parameters
contained in an array
2006-01-21 Sebastian Mendel <cybot_tm@users.sourceforge.net> 2006-01-21 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* tbl_printview.php: typo * tbl_printview.php: typo

View File

@@ -440,6 +440,7 @@ function PMA_array_merge_recursive()
return false; return false;
break; break;
case 1 : case 1 :
// when does that happen?
return func_get_arg(0); return func_get_arg(0);
break; break;
case 2 : case 2 :
@@ -448,10 +449,17 @@ function PMA_array_merge_recursive()
return $args[1]; return $args[1];
} }
foreach ($args[1] AS $key2 => $value2) { foreach ($args[1] AS $key2 => $value2) {
if (isset($args[0][$key2])) { if (isset($args[0][$key2]) && !is_int($key2)) {
$args[0][$key2] = PMA_array_merge_recursive($args[0][$key2], $args[0][$key2] = PMA_array_merge_recursive($args[0][$key2],
$value2); $value2);
} else { } else {
// we erase the parent array, otherwise we cannot override a directive that
// contains array elements, like this:
// (in config.default.php) $cfg['ForeignKeyDropdownOrder'] = array('id-content','content-id');
// (in config.inc.php) $cfg['ForeignKeyDropdownOrder'] = array('content-id');
if (is_int($key2) && $key2 == 0) {
unset($args[0]);
}
$args[0][$key2] = $value2; $args[0][$key2] = $value2;
} }
} }