https://bugzilla.wikimedia.org/show_bug.cgi?id=39674

       Web browser: ---
             Bug #: 39674
           Summary: User::load() does not account for failure to load from
                    session.
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: General/Unknown
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified
   Mobile Platform: ---


It seems when a user is loaded from session, but the UserLoadFromSession hook
aborts the process (by settings $result to false), User::load() will just not
do anything. In other words, when a hook aborts, the User private variables are
not initialized, meaning $mId and $mName are still null rather than false.
Because of this, MediaWiki thinks the user is logged in and has a blank
username, causing an exception to be thrown when the personal URLs are
generated in SkinTemplate::loadPersonalUrls(). This occurred using Git master.

Steps to reproduce:
1. Add this function somewhere:
function wfBugTest( $user, &$result ) {
    $result = false;
    return true;
}
2. Add the function into the UserLoadFromSession hook.
3. Try to access the wiki.
Expected Result: User is logged out no matter what.
Actual Result: Exception is thrown (details below).

MediaWiki internal error.

Original exception: exception 'MWException' with message
'SkinTemplate::makeTalkUrlDetails given invalid pagename User:' in
/var/www/site/wiki/includes/SkinTemplate.php:727
Stack trace:
#0 /var/www/site/wiki/includes/SkinTemplate.php(654):
SkinTemplate->makeTalkUrlDetails('User:')
#1 /var/www/site/wiki/includes/SkinTemplate.php(455):
SkinTemplate->buildPersonalUrls()
#2 /var/www/site/wiki/includes/OutputPage.php(1998): SkinTemplate->outputPage()
#3 /var/www/site/wiki/includes/Wiki.php(543): OutputPage->output()
#4 /var/www/site/wiki/includes/Wiki.php(446): MediaWiki->main()
#5 /var/www/site/wiki/index.php(58): MediaWiki->run()
#6 {main}

Exception caught inside exception handler: exception 'MWException' with message
'SkinTemplate::makeTalkUrlDetails given invalid pagename User:' in
/var/www/site/wiki/includes/SkinTemplate.php:727
Stack trace:
#0 /var/www/site/wiki/includes/SkinTemplate.php(654):
SkinTemplate->makeTalkUrlDetails('User:')
#1 /var/www/site/wiki/includes/SkinTemplate.php(455):
SkinTemplate->buildPersonalUrls()
#2 /var/www/site/wiki/includes/OutputPage.php(1998): SkinTemplate->outputPage()
#3 /var/www/site/wiki/includes/Exception.php(227): OutputPage->output()
#4 /var/www/site/wiki/includes/Exception.php(273): MWException->reportHTML()
#5 /var/www/site/wiki/includes/Exception.php(624): MWException->report()
#6 /var/www/site/wiki/includes/Exception.php(705):
MWExceptionHandler::report(Object(MWException))
#7 /var/www/site/wiki/includes/Wiki.php(449):
MWExceptionHandler::handle(Object(MWException))
#8 /var/www/site/wiki/index.php(58): MediaWiki->run()
#9 {main}

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- 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
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to