Page MenuHomePhabricator

Unable to save change on any page using Translate git master: "Call to undefined method WikitextContent::getText()" on MW1.32/1.33
Closed, ResolvedPublic

Description

Hello,

After follonwing this setup guide, https://www.mediawiki.org/wiki/MediaWiki_Language_Extension_Bundle
all extension are correctly setup and database is updated correcty.

Im on mediawiki 1.32

I get this message in frontend :

Caught exception of type Error

i get in debug this message :

[exception] [bd5ca323b78d710f11791c0c] /index.php?title=Accueil&action=submit Error from line 896 of /var/www/custs/hopla.cloud/wikipp/extensions/Translate/TranslateHooks.php: Call to undefined method WikitextContent::getText()

im unable to save a page if translate is enabled

can reproduce on production and preproduction

Event Timeline

setup detail :
MediaWiki 1.32.2
PHP 7.3.6-1+ubuntu18.04.1+deb.sury.org+1 (fpm-fcgi)
MariaDB 10.3.16-MariaDB-1:10.3.16+maria~bionic
ICU 64.1

Looking at the TranslateHooks file in REL1_32, there's no call to getText. That's because it was introduced with https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Translate/+/500243/, which is in master, but not even in 1.33. Since you said you're using MediaWiki 1.32, that would explain the problem here. You should use the 1.32 version of Translate with it.

Leaving open in case I missed something.

Aklapper renamed this task from Unable to save change on any page after Translate setup to Unable to save change on any page after Translate setup: "Call to undefined method WikitextContent::getText()".Sep 18 2019, 10:36 AM
Aklapper closed this task as Invalid.

Closing as per last comment; basically: don't mix the git master branch of an extension with an old stable MediaWiki version. :)

Nikerabbit subscribed.

Our master branch should be compatible with 1.32 (likely 1.33 after next MLEB release).

Aklapper renamed this task from Unable to save change on any page after Translate setup: "Call to undefined method WikitextContent::getText()" to Unable to save change on any page using Translate git master: "Call to undefined method WikitextContent::getText()" on MW1.32/1.33.Sep 18 2019, 3:07 PM

Hello @Pginer-WMF

I had to test backward compatibility for another task - T228675: Remove direct access to the text table from the Translate extension. and for that I had to fix this issue. This was a fairly simple fix, and since we need to fix it as part of the next MLEB release I've submitted a patch to fix this.

Change 538756 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Call TextContent::getNativeData when getText is unavailable

https://gerrit.wikimedia.org/r/538756

Change 538756 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Call TextContent::getNativeData when getText is unavailable

https://gerrit.wikimedia.org/r/538756

@Jpita - You would need to setup a new instance of MediaWiki 1.32 locally, install the Translate extension, mark the pages for translation and then try to translate. If you are able to do that successfully, then we can be certain that this bug is fixed.

Tested this as part of T236978: Test MLEB 2019.10

Did not face this issue. Marking this as resolved.