From: Andrew Garrett Date: Tue, 19 Aug 2008 01:11:02 +0000 (+0000) Subject: Use array_merge_recursive instead of array_merge for merging settings. X-Git-Tag: 1.31.0-rc.0~45808 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=612fdcfc530f8cbbaf7cb75a7c8305328040e750;p=lhc%2Fweb%2Fwiklou.git Use array_merge_recursive instead of array_merge for merging settings. --- diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index 0ed768791c..77885f2728 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -47,7 +47,7 @@ class SiteConfiguration { foreach ( $wikiTags as $tag ) { if ( array_key_exists( $tag, $thisSetting ) ) { if ( isset($retval) && is_array($retval) && is_array($thisSetting[$tag]) ) { - $retval = array_merge( $retval, $thisSetting[$tag] ); + $retval = array_merge_recursive( $retval, $thisSetting[$tag] ); } else { $retval = $thisSetting[$tag]; } @@ -55,14 +55,14 @@ class SiteConfiguration { } elseif ( array_key_exists( "+$tag", $thisSetting ) && is_array($thisSetting["+$tag"]) ) { if (!isset($retval)) $retval = array(); - $retval = array_merge( $retval, $thisSetting["+$tag"] ); + $retval = array_merge_recursive( $retval, $thisSetting["+$tag"] ); } } // Do suffix settings if ( array_key_exists( $suffix, $thisSetting ) ) { if ( isset($retval) && is_array($retval) && is_array($thisSetting[$suffix]) ) { - $retval = array_merge( $retval, $thisSetting[$suffix] ); + $retval = array_merge_recursive( $retval, $thisSetting[$suffix] ); } else { $retval = $thisSetting[$suffix]; } @@ -70,13 +70,13 @@ class SiteConfiguration { } elseif ( array_key_exists( "+$suffix", $thisSetting ) && is_array($thisSetting["+$suffix"]) ) { if (!isset($retval)) $retval = array(); - $retval = array_merge( $retval, $thisSetting["+$suffix"] ); + $retval = array_merge_recursive( $retval, $thisSetting["+$suffix"] ); } // Fall back to default. if ( array_key_exists( 'default', $thisSetting ) ) { if ( isset($retval) && is_array($retval) && is_array($thisSetting['default']) ) { - $retval = array_merge( $retval, $thisSetting['default'] ); + $retval = array_merge_recursive( $retval, $thisSetting['default'] ); } else { $retval = $thisSetting['default']; } @@ -181,7 +181,7 @@ class SiteConfiguration { if (substr($setting,0,1) == '+' && is_array($value)) { $setting = substr($setting,1); if ( is_array($GLOBALS[$setting]) ) { - $GLOBALS[$setting] = array_merge( $GLOBALS[$setting], $value ); + $GLOBALS[$setting] = array_merge_recursive( $GLOBALS[$setting], $value ); } else { $GLOBALS[$setting] = $value; }