Merge "Preferences.php: avoid "Undefined index" if key 'realname' don't exist in...
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 19 Mar 2014 22:53:31 +0000 (22:53 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 19 Mar 2014 22:53:31 +0000 (22:53 +0000)
1  2 
includes/Preferences.php

diff --combined includes/Preferences.php
@@@ -193,7 -193,7 +193,7 @@@ class Preferences 
         */
        static function profilePreferences( $user, IContextSource $context, &$defaultPreferences ) {
                global $wgAuth, $wgContLang, $wgParser, $wgCookieExpiration, $wgLanguageCode,
 -                      $wgDisableTitleConversion, $wgDisableLangConversion, $wgMaxSigChars,
 +                      $wgDisableLangConversion, $wgMaxSigChars,
                        $wgEnableEmail, $wgEmailConfirmToEdit, $wgEnableUserEmail, $wgEmailAuthentication,
                        $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifRevealEditorAddress,
                        $wgSecureLogin;
                                                'section' => 'personal/i18n',
                                                'help-message' => 'prefs-help-variant',
                                        );
 -
 -                                      if ( !$wgDisableTitleConversion ) {
 -                                              $defaultPreferences['noconvertlink'] = array(
 -                                                      'type' => 'toggle',
 -                                                      'section' => 'personal/i18n',
 -                                                      'label-message' => 'tog-noconvertlink',
 -                                              );
 -                                      }
                                } else {
                                        $defaultPreferences["variant-$langCode"] = array(
                                                'type' => 'api',
  
                // Fortunately, the realname field is MUCH simpler
                // (not really "private", but still shouldn't be edited without permission)
-               if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->isAllowed( 'editmyprivateinfo' ) ) {
+               if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->isAllowed( 'editmyprivateinfo' ) && array_key_exists( 'realname', $formData ) ) {
                        $realName = $formData['realname'];
                        $user->setRealName( $realName );
                }