}
function getInputHTML( $value ) {
+ $value = HTMLFormField::forceToStringRecursive( $value );
$html = $this->formatOptions( $this->getOptions(), $value );
return $html;
}
function filterDataForSubmit( $data ) {
+ $data = HTMLFormField::forceToStringRecursive( $data );
$options = HTMLFormField::flattenOptions( $this->getOptions() );
$res = array();
foreach ( $options as $opt ) {
- $res["$opt"] = in_array( $opt, $data );
+ $res["$opt"] = in_array( $opt, $data, true );
}
return $res;
$validOptions = HTMLFormField::flattenOptions( $this->getOptions() );
- if ( in_array( $value, $validOptions ) ) {
+ if ( in_array( strval( $value ), $validOptions, true ) ) {
return true;
} else {
return $this->msg( 'htmlform-select-badoption' )->parse();
* @return String
*/
function getInputHTML( $value ) {
- $html = $this->formatOptions( $this->getOptions(), $value );
+ $html = $this->formatOptions( $this->getOptions(), strval( $value ) );
return $html;
}
$html .= $this->formatOptions( $info, $value );
} else {
$id = Sanitizer::escapeId( $this->mID . "-$info" );
- $radio = Xml::radio( $this->mName, $info, $info == $value, $attribs + array( 'id' => $id ) );
+ $radio = Xml::radio( $this->mName, $info, $info === $value, $attribs + array( 'id' => $id ) );
$radio .= ' ' . call_user_func( $elementFunc, 'label', array( 'for' => $id ), $label );
$html .= ' ' . Html::rawElement(
if ( $list == 'other' ) {
$final = $text;
- } elseif ( !in_array( $list, $this->mFlatOptions ) ) {
+ } elseif ( !in_array( $list, $this->mFlatOptions, true ) ) {
# User has spoofed the select form to give an option which wasn't
# in the original offer. Sulk...
$final = $text;
$validOptions = HTMLFormField::flattenOptions( $this->getOptions() );
- if ( in_array( $value, $validOptions ) ) {
+ if ( in_array( strval( $value ), $validOptions, true ) ) {
return true;
} else {
return $this->msg( 'htmlform-select-badoption' )->parse();
$valInSelect = false;
if ( $value !== false ) {
- $valInSelect = in_array( $value, HTMLFormField::flattenOptions( $this->getOptions() ) );
+ $value = strval( $value );
+ $valInSelect = in_array(
+ $value, HTMLFormField::flattenOptions( $this->getOptions() ), true
+ );
}
$selected = $valInSelect ? $value : 'other';
if ( $request->getCheck( $this->mName ) ) {
$val = $request->getText( $this->mName );
- if ( $val == 'other' ) {
+ if ( $val === 'other' ) {
$val = $request->getText( $this->mName . '-other' );
}