From: Andrew Garrett Date: Wed, 3 Jun 2009 09:38:36 +0000 (+0000) Subject: Fix logic error involving interpretation of result from validate() method, causing... X-Git-Tag: 1.31.0-rc.0~41529 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=f37979bcca46ad968aa1396d3f752373f204d86e;p=lhc%2Fweb%2Fwiklou.git Fix logic error involving interpretation of result from validate() method, causing bug 18763 "Unable to save preferences after switching language" and possibly others. --- diff --git a/includes/Preferences.php b/includes/Preferences.php index c659144842..f7af653223 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -51,10 +51,12 @@ class Preferences { // Already set, no problem continue; } elseif ( !is_null( $prefFromUser ) && // Make sure we're not just pulling nothing - $field->validate( $prefFromUser, $user->mOptions ) ) { + $field->validate( $prefFromUser, $user->mOptions ) === true ) { $info['default'] = $prefFromUser; - } elseif( $field->validate( $globalDefault, $user->mOptions ) ) { + } elseif( $field->validate( $globalDefault, $user->mOptions ) === true ) { $info['default'] = $globalDefault; + } else { + throw new MWException( "Global default $globalDefault is invalid for field $name" ); } }