Page MenuHomePhabricator

Wikibase Repo: Catchable fatal error: Argument 2 passed to Wikibase\RepoHooks::onPageContentLanguage() must be an instance of Language, string given
Closed, ResolvedPublic

Description

[01-Nov-2012 22:55:22] Catchable fatal error: Argument 2 passed to Wikibase\RepoHooks::onPageContentLanguage() must be an instance of Language, string given at /usr/local/apache/common-local/php-1.21wmf3/extensions/Wikibase/repo/Wikibase.hooks.php on line 153
Server: mw21
Method: GET
URL: http://www.wikidata.org/w/index.php?title=MediaWiki:Gadget-HotCatsMultiCustomEdit.js&action=raw&ctype=text/javascript
Backtrace:
#0 /usr/local/apache/common-local/php-1.21wmf3/extensions/Wikibase/repo/Wikibase.hooks.php(153): Wikibase\RepoHooks::onPageContentLanguage()
#1 [internal function]: Wikibase\RepoHooks::onPageContentLanguage(Object(Title), 'en', Object(StubUserLang))
#2 /usr/local/apache/common-local/php-1.21wmf3/includes/Hooks.php(253): call_user_func_array('Wikibase\RepoHo...', Array)
#3 /usr/local/apache/common-local/php-1.21wmf3/includes/GlobalFunctions.php(3819): Hooks::run('PageContentLang...', Array)
#4 /usr/local/apache/common-local/php-1.21wmf3/includes/Title.php(4706): wfRunHooks('PageContentLang...', Array)
#5 /usr/local/apache/common-local/php-1.21wmf3/includes/Title.php(3422): Title->getPageLanguage()
#6 /usr/local/apache/common-local/php-1.21wmf3/includes/Wiki.php(424): Title->getSquidURLs()
#7 /usr/local/apache/common-local/php-1.21wmf3/includes/Wiki.php(305): MediaWiki->performAction(Object(Article), Object(Title))
#8 /usr/local/apache/common-local/php-1.21wmf3/includes/Wiki.php(555): MediaWiki->performRequest()
#9 /usr/local/apache/common-local/php-1.21wmf3/includes/Wiki.php(448): MediaWiki->main()
#10 /usr/local/apache/common-local/php-1.21wmf3/index.php(59): MediaWiki->run()
#11 /usr/local/apache/common-local/live-1.5/index.php(3): require('/usr/local/apac...')
#12 {main}


Version: unspecified
Severity: major

Details

Reference
bz41667

Event Timeline

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

I don't understand why this error occurs, since 'en' is always passed with wfGetLangObj() so it's always a Language object. The last commit changing the page language code was gerrit change 22732, so it's strange that is only now discovered. But as far as I tested, this bug too is fixed with gerrit change 30615.

So I guess it's best to backport that change to wmf3, since it fixes two major bugs.

Change Id52f4e5b: Fix for onPageContentLanguage

  • Bug 41739 has been marked as a duplicate of this bug. ***

(In reply to comment #1)

I don't understand why this error occurs, since 'en' is always passed with
wfGetLangObj() so it's always a Language object. The last commit changing the
page language code was Gerrit change #22732, so it's strange that is only now
discovered. But as far as I tested, this bug too is fixed with gerrit change

So I guess it's best to backport that change to wmf3, since it fixes two major
bugs.

30615 doesn't fix the issue. Backported and merged in https://gerrit.wikimedia.org/r/#/c/31651/

This is a very strange bug. Simplest way to fix it is to remove the Language next to the parameter. See my comment on Gerrit change 31650.

I51dabe9a is related, might "accidentally" fix this.

Also: we could just ditch the entire hook function, EntityContent can just implement getPageLanguage directly. Thats probably cleaner anyway.

  • Bug 41734 has been marked as a duplicate of this bug. ***

Not sure when and why this happened exactly, one way would be another hook handler setting the value to a string (which is legal according to the documentation).

Anyway, Ia0ba6518 should fix this.

(In reply to comment #6)

I51dabe9a is related, might "accidentally" fix this.

That is what I had said above too, but it didn't.

(In reply to comment #8)

Not sure when and why this happened exactly, one way would be another hook
handler setting the value to a string (which is legal according to the
documentation).

I tested and did not find any way it got set to a string. As I said above, it is a very strange bug. Seems more like a bug in the hook system afaics.

Anyway, Ia0ba6518 should fix this.

It does (although I don't like the solution of a difference between the page content and page view language, but that's discussion for gerrit change 31361).

So probably best to backport Ia0ba6518 to get it fixed on the live wikidata ;-)

Marking the bug as fixed.

Disabling use of PageContentLanguage hook in the wikidata-wmfphase1beta branch in deployment. This should fix the bug for what's in deployment now.

https://gerrit.wikimedia.org/r/#/c/32042/

0.2 branch and master should have a different, less hacky fix.

(In reply to comment #10)

0.2 branch and master should have a different, less hacky fix.

Actually, that fix is pretty much the same: remove the hook function (and unregister it, of course). We don't need it, because EntityContent is implementing getPageViewLanguage and (then also) getPageLanguage directly.