Page MenuHomePhabricator

Attempting to translate a page into a non-permitted language results in 500 error rather than clean error
Closed, ResolvedPublic

Description

Author: rob

Description:
I'm running MediaWiki 1.19.1, just done a fresh pull of Translate from git, master branch. My apologies for any inaccuracies in terminology - I'm very new to MediaWiki, a little rusty with PHP but use git daily.

How to recreate:-

Set up a user account with 'en' as its language
Create a page, in English, and mark it for translation into German only (by setting 'de' as a priority translation and checking 'disallow translation into other languages'.
Click 'Translate this page'.

A 500 error will be returned, and this placed into the logs:-

[Wed Jun 20 23:07:59 2012] [error] [client xx.xx.xx.xx] PHP Fatal error: Call to undefined method Language::fetchLanguageName() in /home/sites/mysite.com/public_html/wiki/extensions/Translate/specials/SpecialTranslate.php on line 163, referer: http://wiki.mysite.com/index.php?title=XX_XX_XX

-: the page requested was :-

http://wiki.mysite.com/index.php?title=Special%3ATranslate&taction=translate&group=page-XX+XX+XX&language=en&limit=100&task=view

By changing the language GET param to 'de', the page displays properly.

I believe this bug was introduced in commit 76cd8533, as checking out the commit prior to this results in a sane error message being displayed.

I'm happy to grant access to my install to developers if the bug can't be recreated on a test env.


Version: master
Severity: major

Details

Reference
bz37760

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 12:25 AM
bzimport set Reference to bz37760.

rob wrote:

Just checked out latest master in git - issue isn't resolved.

I may have my logic completely wrong, but it looks like there's no function called fetchLanguageName defined anywhere:-

[mysite.com@mywebserver wiki]$ pwd
/home/sites/mysite.com/public_html/wiki
[mysite.com@mywebserver wiki]$ grep -r fetchLanguage .
./extensions/Translate/specials/SpecialTranslate.php: Language::fetchLanguageName( $this->options['language'], $wgLang->getCode() ),
./extensions/Translate/TranslateUtils.php: if ( is_callable( array( 'Language', 'fetchLanguageNames' ) ) ) {
./extensions/Translate/TranslateUtils.php: $languageNames = Language::fetchLanguageNames( $code, 'mw' ); // since 1.20

The patch was probably not merged at that time. Please try again.

rob wrote:

The checkout that I had included commit c37971fe, which appeared to be the merged patch. I've just checked out latest (last commit 940517c8) and the bug still exists.

rob wrote:

Confirmed fixed :) Thanks!