From 2edb509535e0ca1d6b05a90caa3a0cdeafa32aa8 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 22 Jan 2006 19:22:17 +0000 Subject: [PATCH] bug #1410787, incorrect merging of parameters contained in an array --- ChangeLog | 4 ++++ libraries/common.lib.php | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 76e74e068..345066564 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2006-01-22 Marc Delisle + * libraries/common.lib.php: bug #1410787, incorrect merging of parameters + contained in an array + 2006-01-21 Sebastian Mendel * tbl_printview.php: typo diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 57a5338e4..ce9b96c60 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -440,6 +440,7 @@ function PMA_array_merge_recursive() return false; break; case 1 : + // when does that happen? return func_get_arg(0); break; case 2 : @@ -448,10 +449,17 @@ function PMA_array_merge_recursive() return $args[1]; } 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], $value2); } 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; } }