Revision: 52070
Author:   werdna
Date:     2009-06-17 19:08:14 +0000 (Wed, 17 Jun 2009)

Log Message:
-----------
Fix for string/int inconsistency in value and option for imagesize, resulting 
in unintended preference reversion.

Modified Paths:
--------------
    trunk/phase3/includes/HTMLForm.php

Modified: trunk/phase3/includes/HTMLForm.php
===================================================================
--- trunk/phase3/includes/HTMLForm.php  2009-06-17 19:02:54 UTC (rev 52069)
+++ trunk/phase3/includes/HTMLForm.php  2009-06-17 19:08:14 UTC (rev 52070)
@@ -601,13 +601,18 @@
        }
        
        function getInputHTML( $value ) {               
-               $select = new XmlSelect( $this->mName, $this->mID, $value );
+               $select = new XmlSelect( $this->mName, $this->mID, 
strval($value) );
                
+               // If one of the options' 'name' is int(0), it is automatically 
selected.
+               //  because PHP sucks and things int(0) == 'some string'.
+               //  Working around this by forcing all of them to strings.
+               $options = array_map( 'strval', $this->mParams['options'] );
+               
                if (!empty($this->mParams['disabled'])) {
                        $select->setAttribute( 'disabled', 'disabled' );
                }
                
-               $select->addOptions( $this->mParams['options'] );
+               $select->addOptions( $options );
                
                return $select->getHTML();
        }



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to