From f37979bcca46ad968aa1396d3f752373f204d86e Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Wed, 3 Jun 2009 09:38:36 +0000 Subject: [PATCH] Fix logic error involving interpretation of result from validate() method, causing bug 18763 "Unable to save preferences after switching language" and possibly others. --- includes/Preferences.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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" ); } } -- 2.20.1