* Allow Xml::check() $attribs parameter to override 'value' attribute
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 8 Dec 2006 23:07:06 +0000 (23:07 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 8 Dec 2006 23:07:06 +0000 (23:07 +0000)
PHP's array + operator doesn't overwrite items from the left side when
keys conflict. Switch to array_merge() here, which acts as expected.

RELEASE-NOTES
includes/Xml.php

index 0157af6..85e66da 100644 (file)
@@ -253,6 +253,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Added redirect to section feature. Use it wisely.
 * Added a configuration variable allowing the "break out of framesets" feature 
   to be switched on and off ($wgBreakFrames). Off by default.
+* Allow Xml::check() $attribs parameter to override 'value' attribute
 
 
 == Languages updated ==
index 509ed9a..25c23ed 100644 (file)
@@ -128,10 +128,13 @@ class Xml {
         * @return string HTML
         */
        public static function check( $name, $checked=false, $attribs=array() ) {
-               return self::element( 'input', array(
-                       'name' => $name,
-                       'type' => 'checkbox',
-                       'value' => 1 ) + self::attrib( 'checked', $checked ) +  $attribs );
+               return self::element( 'input', array_merge(
+                       array(
+                               'name' => $name,
+                               'type' => 'checkbox',
+                               'value' => 1 ),
+                       self::attrib( 'checked', $checked ),
+                       $attribs ) );
        }
 
        /**