Page MenuHomePhabricator

Fatal error: Call to a member function getCode() on a non-object
Closed, ResolvedPublic

Description

[20-Jun-2013 18:04:58] Fatal error: Call to a member function getCode() on a non-object at /usr/local/apache/common-local/php-1.22wmf8/includes/GlobalFunctions.php on line 1288
Server: mw1007
URL: http://[unknown-host]
Backtrace:
#0 /usr/local/apache/common-local/php-1.22wmf8/includes/GlobalFunctions.php(1288): wfGetLangObj()
#1 /usr/local/apache/common-local/php-1.22wmf8/includes/cache/MessageCache.php(728): wfGetLangObj(NULL)
#2 /usr/local/apache/common-local/php-1.22wmf8/includes/Message.php(720): MessageCache->get('proofreadpage_n...', true, NULL)
#3 /usr/local/apache/common-local/php-1.22wmf8/includes/Message.php(464): Message->fetchMessage()
#4 /usr/local/apache/common-local/php-1.22wmf8/includes/Message.php(563): Message->toString()
#5 /usr/local/apache/common-local/php-1.22wmf8/extensions/ProofreadPage/includes/ProofreadPageInit.php(140): Message->plain()
#6 /usr/local/apache/common-local/php-1.22wmf8/extensions/ProofreadPage/ProofreadPage.body.php(37): ProofreadPageInit::getNamespaceId('page', 'proofreadpage_n...')
#7 /usr/local/apache/common-local/php-1.22wmf8/extensions/ProofreadPage/ProofreadPage.body.php(1612): ProofreadPage::getPageNamespaceId()
#8 [internal function]: ProofreadPage::addCanonicalNamespaces(Array)
#9 /usr/local/apache/common-local/php-1.22wmf8/includes/Hooks.php(196): call_user_func_array('ProofreadPage::...', Array)
#10 /usr/local/apache/common-local/php-1.22wmf8/includes/GlobalFunctions.php(3834): Hooks::run('CanonicalNamesp...', Array)
#11 /usr/local/apache/common-local/php-1.22wmf8/includes/Namespace.php(226): wfRunHooks('CanonicalNamesp...', Array)
#12 /usr/local/apache/common-local/php-1.22wmf8/includes/Namespace.php(277): MWNamespace::getCanonicalNamespaces()
#13 /usr/local/apache/common-local/php-1.22wmf8/includes/Namespace.php(367): MWNamespace::getValidNamespaces()
#14 /usr/local/apache/common-local/wmf-config/CommonSettings.php(2515): MWNamespace::getTalkNamespaces()
#15 [internal function]: wmfWBClientExcludeNS()
#16 /usr/local/apache/common-local/php-1.22wmf8/includes/Hooks.php(196): call_user_func_array('wmfWBClientExcl...', Array)
#17 /usr/local/apache/common-local/php-1.22wmf8/includes/GlobalFunctions.php(3834): Hooks::run('SetupAfterCache', Array)
#18 /usr/local/apache/common-local/php-1.22wmf8/includes/Setup.php(497): wfRunHooks('SetupAfterCache')
#19 /usr/local/apache/common-local/php-1.22wmf8/maintenance/doMaintenance.php(107): require_once('/usr/local/apac...')
#20 /usr/local/apache/common-local/php-1.22wmf8/maintenance/runJobs.php(153): require_once('/usr/local/apac...')
#21 /usr/local/apache/common-local/multiversion/MWScript.php(97): require_once('/usr/local/apac...')


Version: master
Severity: major

Details

Reference
bz49897

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:43 AM
bzimport added a project: ProofreadPage.
bzimport set Reference to bz49897.
bzimport added a subscriber: Unknown Object (MLST).

[20-Jun-2013 18:18:10] Fatal error: Call to a member function getCode() on a non-object at /usr/local/apache/common-local/php-1.22wmf8/includes/GlobalFunctions.php on line 1288
Server: mw1186
Method: GET
URL: http://test2.wikipedia.org/
Backtrace:
#0 /usr/local/apache/common-local/php-1.22wmf8/includes/GlobalFunctions.php(1288): wfGetLangObj()
#1 /usr/local/apache/common-local/php-1.22wmf8/includes/cache/MessageCache.php(728): wfGetLangObj(NULL)
#2 /usr/local/apache/common-local/php-1.22wmf8/includes/Message.php(720): MessageCache->get('proofreadpage_n...', true, NULL)
#3 /usr/local/apache/common-local/php-1.22wmf8/includes/Message.php(464): Message->fetchMessage()
#4 /usr/local/apache/common-local/php-1.22wmf8/includes/Message.php(563): Message->toString()
#5 /usr/local/apache/common-local/php-1.22wmf8/extensions/ProofreadPage/includes/ProofreadPageInit.php(140): Message->plain()
#6 /usr/local/apache/common-local/php-1.22wmf8/extensions/ProofreadPage/ProofreadPage.body.php(37): ProofreadPageInit::getNamespaceId('page', 'proofreadpage_n...')
#7 /usr/local/apache/common-local/php-1.22wmf8/extensions/ProofreadPage/ProofreadPage.body.php(1612): ProofreadPage::getPageNamespaceId()
#8 [internal function]: ProofreadPage::addCanonicalNamespaces(Array)
#9 /usr/local/apache/common-local/php-1.22wmf8/includes/Hooks.php(196): call_user_func_array('ProofreadPage::...', Array)
#10 /usr/local/apache/common-local/php-1.22wmf8/includes/GlobalFunctions.php(3834): Hooks::run('CanonicalNamesp...', Array)
#11 /usr/local/apache/common-local/php-1.22wmf8/includes/Namespace.php(226): wfRunHooks('CanonicalNamesp...', Array)
#12 /usr/local/apache/common-local/php-1.22wmf8/includes/Namespace.php(277): MWNamespace::getCanonicalNamespaces()
#13 /usr/local/apache/common-local/php-1.22wmf8/includes/Namespace.php(367): MWNamespace::getValidNamespaces()
#14 /usr/local/apache/common-local/wmf-config/CommonSettings.php(2515): MWNamespace::getTalkNamespaces()
#15 [internal function]: wmfWBClientExcludeNS()
#16 /usr/local/apache/common-local/php-1.22wmf8/includes/Hooks.php(196): call_user_func_array('wmfWBClientExcl...', Array)
#17 /usr/local/apache/common-local/php-1.22wmf8/includes/GlobalFunctions.php(3834): Hooks::run('SetupAfterCache', Array)
#18 /usr/local/apache/common-local/php-1.22wmf8/includes/Setup.php(497): wfRunHooks('SetupAfterCache')
#19 /usr/local/apache/common-local/php-1.22wmf8/includes/WebStart.php(156): require_once('/usr/local/apac...')

So this call wfMessage in middle of the setup procedure. Hook is called on line 497, while $wgContLang is only set up on line 518.

The bug is caused by change Ie0800246e7b995ec4f3e9d19b0f6705fb72afa1c that introduce a call of the initialization of the page and index namespaces ids in the ProofreadPage:addCanonicalNamespaces method that is called by a hook called itself by SetupAfterCache. So the initialization of the ids are now done at this step and not after. A strange thing is that my test wiki is not affected.

From IRC: perhaps a workaround would be to use $wgLanguageCode instead of $wgContLang, or setup $wgContLang earlier. But I'd like code not to call wfMessage that early

The major issue here is that namespaces used by ProofreadPage were configured using messages: to say to the extension to use as page namespaces the namespace "Page" people adds "Page" in the proofreadpage_namespace message. I have created last year a configuration variable $wgProofreadPageNamespaceIds that allows to set these namespaces in the site configuration. All Wikimedia site have been moved to the new system. I think that we can now remove the support of this legacy feature. So, I'll make a patch to remove calls to mwMessage and an other to migrate remaining wikis (test2 and maybe one or two others).

Related URL: https://gerrit.wikimedia.org/r/69754 (Gerrit Change I0037f74ea3a0624d90508ba0c271445231807b11)

Related URL: https://gerrit.wikimedia.org/r/69755 (Gerrit Change I6bdb111ca6a83773a65aa9f06c7f5d0126f4f9db)

https://gerrit.wikimedia.org/r/69755 (Gerrit Change I6bdb111ca6a83773a65aa9f06c7f5d0126f4f9db) | change APPROVED and MERGED [by jenkins-bot]

https://gerrit.wikimedia.org/r/69754 (Gerrit Change I0037f74ea3a0624d90508ba0c271445231807b11) | change APPROVED and MERGED [by Reedy]

The issue have been fixed. test2 is working fine now.