r39623 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39622‎ | r39623 | r39624 >
Date:01:11, 19 August 2008
Author:werdna
Status:old
Tags:
Comment:
Use array_merge_recursive instead of array_merge for merging settings.
Modified paths:
  • /trunk/phase3/includes/SiteConfiguration.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SiteConfiguration.php
@@ -47,7 +47,7 @@
4848 foreach ( $wikiTags as $tag ) {
4949 if ( array_key_exists( $tag, $thisSetting ) ) {
5050 if ( isset($retval) && is_array($retval) && is_array($thisSetting[$tag]) ) {
51 - $retval = array_merge( $retval, $thisSetting[$tag] );
 51+ $retval = array_merge_recursive( $retval, $thisSetting[$tag] );
5252 } else {
5353 $retval = $thisSetting[$tag];
5454 }
@@ -55,14 +55,14 @@
5656 } elseif ( array_key_exists( "+$tag", $thisSetting ) && is_array($thisSetting["+$tag"]) ) {
5757 if (!isset($retval))
5858 $retval = array();
59 - $retval = array_merge( $retval, $thisSetting["+$tag"] );
 59+ $retval = array_merge_recursive( $retval, $thisSetting["+$tag"] );
6060 }
6161 }
6262
6363 // Do suffix settings
6464 if ( array_key_exists( $suffix, $thisSetting ) ) {
6565 if ( isset($retval) && is_array($retval) && is_array($thisSetting[$suffix]) ) {
66 - $retval = array_merge( $retval, $thisSetting[$suffix] );
 66+ $retval = array_merge_recursive( $retval, $thisSetting[$suffix] );
6767 } else {
6868 $retval = $thisSetting[$suffix];
6969 }
@@ -70,13 +70,13 @@
7171 } elseif ( array_key_exists( "+$suffix", $thisSetting ) && is_array($thisSetting["+$suffix"]) ) {
7272 if (!isset($retval))
7373 $retval = array();
74 - $retval = array_merge( $retval, $thisSetting["+$suffix"] );
 74+ $retval = array_merge_recursive( $retval, $thisSetting["+$suffix"] );
7575 }
7676
7777 // Fall back to default.
7878 if ( array_key_exists( 'default', $thisSetting ) ) {
7979 if ( isset($retval) && is_array($retval) && is_array($thisSetting['default']) ) {
80 - $retval = array_merge( $retval, $thisSetting['default'] );
 80+ $retval = array_merge_recursive( $retval, $thisSetting['default'] );
8181 } else {
8282 $retval = $thisSetting['default'];
8383 }
@@ -181,7 +181,7 @@
182182 if (substr($setting,0,1) == '+' && is_array($value)) {
183183 $setting = substr($setting,1);
184184 if ( is_array($GLOBALS[$setting]) ) {
185 - $GLOBALS[$setting] = array_merge( $GLOBALS[$setting], $value );
 185+ $GLOBALS[$setting] = array_merge_recursive( $GLOBALS[$setting], $value );
186186 } else {
187187 $GLOBALS[$setting] = $value;
188188 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r39655Revert r39623 "Use array_merge_recursive instead of array_merge for merging s...brion19:05, 19 August 2008

Status & tagging log