r78566 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78565‎ | r78566 | r78567 >
Date:16:25, 18 December 2010
Author:happy-melon
Status:resolved (Comments)
Tags:
Comment:
r52070 breaks the use of optgroups etc: array(...) is cast to 'Array'. Need to only cast integers to strings.
Modified paths:
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HTMLForm.php
@@ -1222,7 +1222,10 @@
12231223 # If one of the options' 'name' is int(0), it is automatically selected.
12241224 # because PHP sucks and things int(0) == 'some string'.
12251225 # Working around this by forcing all of them to strings.
1226 - $options = array_map( 'strval', $this->mParams['options'] );
 1226+ $options = array_map(
 1227+ create_function('$opt', 'return is_int($opt) ? strval($opt) : $opt;'),
 1228+ $this->mParams['options']
 1229+ );
12271230
12281231 if ( !empty( $this->mParams['disabled'] ) ) {
12291232 $select->setAttribute( 'disabled', 'disabled' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r78574Nicer way of doing r78566, and also one which won't incur Tim's wrath... :Dhappy-melon19:08, 18 December 2010
r79140MFT HTMLForm saga (r78452, r78454, r78566, r78574)platonides23:10, 28 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r52070Fix for string/int inconsistency in value and option for imagesize, resulting...werdna19:08, 17 June 2009

Comments

#Comment by IAlex (talk | contribs)   18:36, 18 December 2010

Do not use create_function(), see e.g. r78046.

#Comment by Happy-melon (talk | contribs)   19:10, 18 December 2010

Method in r78574 is nicer anyway...

Status & tagging log