$wgUser is never a Stub since r70970.
authorPlatonides <platonides@users.mediawiki.org>
Sun, 17 Oct 2010 22:33:25 +0000 (22:33 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Sun, 17 Oct 2010 22:33:25 +0000 (22:33 +0000)
This means, the user data was innecessarily loaded here just for the debug message.

It also caused bug 24995 - "fallback" key missing from localization cache.
For languages other than English (short-circuitted in Language.php:2800) during
Language load, it gets the fallback from the localization cache, which used the db,
which then loaded here the User object, which called WebRequest caused unstubbing (again)
of ContentLanguage for unicode normalization, which loaded again the Language (a call
to loadItem( 'xx', 'fallback' ) under loadItem( 'xx', 'fallback' ) stack) and then
caused it to finally fail.

It wasn't an unstub loop, but was near.

Backtrace:
LocalisationCache::loadItem  phase3/includes/LocalisationCache.php:205 <-- Second load of key fallback
LocalisationCache::getItem phase3/languages/Language.php:2802
Language::getFallbackFor phase3/languages/Language.php:169
Language::newFromCode phase3/languages/Language.php:140
Language::factory phase3/includes/StubObject.php:126
StubContLang::_newObject phase3/includes/StubObject.php:103
StubObject::_unstub phase3/includes/StubObject.php:57
StubObject::_call phase3/includes/StubObject.php:121
StubContLang::__call phase3/includes/WebRequest.php:204 <-- Second unstub
StubContLang::normalize phase3/includes/WebRequest.php:204
WebRequest::normalizeUnicode phase3/includes/WebRequest.php:231
WebRequest::getGPCVal phase3/includes/WebRequest.php:460
WebRequest::getCookie phase3/includes/User.php:835
User::loadFromSession phase3/includes/User.php:221
User::load phase3/includes/User.php:1501
User::getName phase3/includes/db/Database.php:658
DatabaseBase::query phase3/includes/db/DatabaseMysql.php:120
DatabaseMysql::open phase3/includes/db/Database.php:530
DatabaseBase::__construct phase3/includes/db/LoadBalancer.php:651
LoadBalancer::reallyOpenConnection phase3/includes/db/LoadBalancer.php:532
LoadBalancer::openConnection phase3/includes/db/LoadBalancer.php:455
LoadBalancer::getConnection phase3/includes/GlobalFunctions.php:3085
wfGetDB phase3/includes/LocalisationCache.php:772
LCStore_DB::get phase3/includes/LocalisationCache.php:326
LocalisationCache::isExpired phase3/includes/LocalisationCache.php:355
LocalisationCache::initLanguage phase3/includes/LocalisationCache.php:267
LocalisationCache::loadItem phase3/includes/LocalisationCache.php:205 <-- First load of key fallback
LocalisationCache::getItem phase3/languages/Language.php:2802
Language::getFallbackFor phase3/languages/Language.php:169
Language::newFromCode phase3/languages/Language.php:140
Language::factory phase3/includes/StubObject.php:126
StubContLang::_newObject phase3/includes/StubObject.php:103
StubObject::_unstub phase3/includes/StubObject.php:57
StubObject::_call phase3/includes/StubObject.php:121
StubContLang::__call phase3/includes/WebRequest.php:228 <-- First unstub
StubContLang::checkTitleEncoding phase3/includes/WebRequest.php:228
WebRequest::getGPCVal phase3/includes/WebRequest.php:250
WebRequest::getVal phase3/index.php:56

includes/db/Database.php

index 444b800..595ceab 100644 (file)
@@ -654,7 +654,7 @@ abstract class DatabaseBase implements DatabaseType {
                # Add a comment for easy SHOW PROCESSLIST interpretation
                # if ( $fname ) {
                        global $wgUser;
-                       if ( is_object( $wgUser ) && !( $wgUser instanceof StubObject ) ) {
+                       if ( is_object( $wgUser ) && $wgUser->mDataLoaded ) {
                                $userName = $wgUser->getName();
                                if ( mb_strlen( $userName ) > 15 ) {
                                        $userName = mb_substr( $userName, 0, 15 ) . '...';