Bug ID: 62029
           Summary: Saving preferences with returning "false" from
                    allowRealNameChange() in AuthPlugin.php causing
                    "Undefined index: realname"
           Product: MediaWiki
           Version: 1.22.2
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Unprioritized
         Component: User preferences
       Web browser: ---
   Mobile Platform: ---

If a sysop doesn't want a user can change his realname (because its set by
extend authPlugin) and adds a allowRealNameChange(), which returns false, to
the AuthPlugin.php, you get a php notice "Undefined index: realname in
Preferences.php line 1439".

If allowPropChange() or allowRealNameChange() from AuthPlugin.php return false
then there is a missing key 'realname' in $formData. 
This causes the mentioned warning and an empty realname string for the user. 
This should either be checked before saving or the index should include the old
realname by default.

Workaround for me: Edit Preferences.php like this:

Preferences.php line 1436
// 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 (!array_key_exists('realname', $formData)) {
      $formData['realname'] = $user->getRealname();

    $realName = $formData['realname'];
    $user->setRealName( $realName );

Message in error.log:
PHP Notice:  Undefined index: realname in
/srv/web/ on
line 1439, referer:

You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
Wikibugs-l mailing list

Reply via email to