Error: PageTranslationHooks.php: [] operator not supported for strings
Closed, ResolvedPublic

Description

On my wiki if I try to view a translated version of a page I get [304305b84fd3b5bd27f3cdc2] 2017-10-03 00:33:50: Fatal exception of type "Error". Debían 9 Php 7.1 MediaWiki 1.29 maridb 10.1

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 3 2017, 12:35 AM
Reedy edited subscribers, added: Reedy; removed: MediaWiki-extensions-Translate.Oct 3 2017, 12:41 AM

Post the stack trace?

Aklapper changed the task status from Open to Stalled.EditedOct 3 2017, 9:39 AM

Please always follow https://mediawiki.org/wiki/How_to_report_a_bug by structuring your tasks and summarizing the issue in the task summary.
You have been asked so before in https://phabricator.wikimedia.org/T170773#3526210. Please do not ignore this.
See https://www.mediawiki.org/wiki/Manual:How_to_debug for debugging. Please always provide exact version information for both MediaWiki and the extension.

Bottom: I did.

MacFan4000 changed the task status from Stalled to Open.Oct 3 2017, 11:16 AM

To repercute prepare a page for translation and mark it, and translate it into any language than try to view the translated version. Translate is on latest commit on the REL1_29 branch

Please enable: $wgShowExceptionDetails = true; and possibly also $wgShowSQLErrors = true;$wgShowDBErrorBacktrace = true; and then post the full details of the error. That will speed up the investigation.

MacFan4000 closed this task as Invalid.Oct 3 2017, 1:22 PM

Actually, now that I tried it on a different machine, it works fine. seemed to be a login issue

MacFan4000 reopened this task as Open.Oct 3 2017, 9:08 PM

Ok it i# still happening, but only while I am logged in.

[c6c7c1c78c089ee86f6db301] /wiki/Main_Page/es Error from line 629 of /var/www/html/extensions/Translate/tag/PageTranslationHooks.php: [] operator not supported for strings

Backtrace:

#0 /var/www/html/includes/Hooks.php(186): PageTranslationHooks::preventPatrolling(Title, User, string, string)
#1 /var/www/html/includes/Title.php(2097): Hooks::run(string, array)
#2 /var/www/html/includes/Title.php(2533): Title->checkPermissionHooks(string, User, array, string, boolean)
#3 /var/www/html/includes/Title.php(1936): Title->getUserPermissionsErrorsInternal(string, User, string, boolean)
#4 /var/www/html/includes/Title.php(1918): Title->userCan(string, User, boolean)
#5 /var/www/html/includes/page/Article.php(956): Title->quickUserCan(string, User)
#6 /var/www/html/includes/page/Article.php(934): Article->showPatrolFooter()
#7 /var/www/html/includes/page/Article.php(653): Article->showViewFooter()
#8 /var/www/html/includes/actions/ViewAction.php(68): Article->view()
#9 /var/www/html/includes/MediaWiki.php(499): ViewAction->show()
#10 /var/www/html/includes/MediaWiki.php(293): MediaWiki->performAction(Article, Title)
#11 /var/www/html/includes/MediaWiki.php(862): MediaWiki->performRequest()
#12 /var/www/html/includes/MediaWiki.php(523): MediaWiki->main()
#13 /var/www/html/index.php(43): MediaWiki->run()
#14 {main}

Aklapper renamed this task from Translate to Error: PageTranslationHooks.php: [] operator not supported for strings.Oct 3 2017, 9:24 PM

Thanks. Line 629 in REL1_29 is in preventPatrolling(): $result[] = 'tpt-patrolling-blocked';.
Wild guess that this might be a PHP 7.1 issue (feel free to remove [DO NOT USE] NewPHP if not).

Aklapper moved this task from Unsorted to PHP 7.1 on the [DO NOT USE] NewPHP board.Oct 3 2017, 9:34 PM

It does appear to be a PHP 7.1 thing. Quote from php docs, “Applying the empty index operator to a string (e.g. $str[] = $x) throws a fatal error instead of converting silently to array.”

Change 382655 had a related patch set uploaded (by Nikerabbit; owner: Nikerabbit):
[mediawiki/extensions/Translate@master] Fix a reported PHP 7.1 incompatibility

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

Change 382655 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Fix a reported PHP 7.1 incompatibility

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

Change 382681 had a related patch set uploaded (by MacFan4000; owner: Nikerabbit):
[mediawiki/extensions/Translate@REL1_30] Fix a reported PHP 7.1 incompatibility

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

Change 382682 had a related patch set uploaded (by MacFan4000; owner: Nikerabbit):
[mediawiki/extensions/Translate@REL1_29] Fix a reported PHP 7.1 incompatibility

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

Change 382698 had a related patch set uploaded (by Reedy; owner: Nikerabbit):
[mediawiki/extensions/Translate@REL1_27] Fix a reported PHP 7.1 incompatibility

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

Change 382699 had a related patch set uploaded (by Reedy; owner: Nikerabbit):
[mediawiki/extensions/Translate@REL1_28] Fix a reported PHP 7.1 incompatibility

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

Change 382681 merged by jenkins-bot:
[mediawiki/extensions/Translate@REL1_30] Fix a reported PHP 7.1 incompatibility

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

Change 382682 merged by jenkins-bot:
[mediawiki/extensions/Translate@REL1_29] Fix a reported PHP 7.1 incompatibility

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

Change 382699 merged by jenkins-bot:
[mediawiki/extensions/Translate@REL1_28] Fix a reported PHP 7.1 incompatibility

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

Change 382698 merged by jenkins-bot:
[mediawiki/extensions/Translate@REL1_27] Fix a reported PHP 7.1 incompatibility

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

Nikerabbit closed this task as Resolved.
Nikerabbit claimed this task.
Anooprao added a comment.EditedOct 6 2017, 4:16 PM

Resolved - translated link pages opens finely now. Thanks for resolving

Nikerabbit moved this task from Backlog to Done on the Language-2017-Oct-Dec board.Nov 7 2017, 7:07 AM