r74932 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74931‎ | r74932 | r74933 >
Date:22:33, 17 October 2010
Author:platonides
Status:ok (Comments)
Tags:
Comment:
$wgUser is never a Stub since r70970.
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
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/Database.php
@@ -654,7 +654,7 @@
655655 # Add a comment for easy SHOW PROCESSLIST interpretation
656656 # if ( $fname ) {
657657 global $wgUser;
658 - if ( is_object( $wgUser ) && !( $wgUser instanceof StubObject ) ) {
 658+ if ( is_object( $wgUser ) && $wgUser->mDataLoaded ) {
659659 $userName = $wgUser->getName();
660660 if ( mb_strlen( $userName ) > 15 ) {
661661 $userName = mb_substr( $userName, 0, 15 ) . '...';

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70970Get rid of StubUser. Constructing a user object isn't quite as intensive as i...demon17:10, 12 August 2010

Comments

#Comment by Catrope (talk | contribs)   08:57, 18 October 2010

Good work!

It'd be nice to have a getter for this rather than using a member variable.

Status & tagging log