Page MenuHomePhabricator

PHP Notices generated by GettextFFS.php & missing new-lines in export.php
Closed, ResolvedPublic

Description

Updated a MediaWiki installation and it's many required extensions a few days ago. I've found some things in the latest 2020.10 MLEB version of Translation extension that should be addressed.
We are currently running MediaWiki 1.35.0 on PHP 7.4.
When running an export using command line tools the following Notices are generated:

PHP Notice: Trying to access array offset on value of type bool in /extensions/Translate/ffs/GettextFFS.php on line 370
PHP Notice: Trying to access array offset on value of type bool in /extensions/Translate/ffs/GettextFFS.php on line 372

Exported PO files still look OK, though I have not verified if content in all the exported files has been changed due to this notice. While the data seems OK for our case, there may be cases where this does cause issues. Unit testing would likely discover these kinds of things before release packages are made. In the mean time I've quieted the message spam by removing the array index from the lines mentioned above.

Additionally, there may be some output lines in /scripts/export.php which are missing line endings. One we have patched to make the output more readable can be found on line 268 of the export script:
$this->output( 'Exporting ' . count( $langs ) . " languages for group $groupId" );
should be:
$this->output( 'Exporting ' . count( $langs ) . " languages for group $groupId \n" );

Of course, I would much prefer an official fix for these so we don't need to keep editing the files when we update. MediaWiki isn't very wiki-like when it comes to managing the software updates - so every convenience in this regard is a welcomed blessing for me.

Take care and thank you for your time!

Related Objects

Event Timeline

Nikerabbit added a subscriber: Nikerabbit.

Honestly, I don't know why MediaWiki claims to have PHP 7.4 support when none of the tests are run for PHP 7.4 in the CI.

Change 639511 had a related patch set uploaded (by Nikerabbit; owner: Nikerabbit):
[mediawiki/extensions/Translate@master] GettextFFS: Fix PHP 7.4 warnings

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

Change 639512 had a related patch set uploaded (by Nikerabbit; owner: Nikerabbit):
[mediawiki/extensions/Translate@master] export.php: Add trailing newlines to some output messages

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

In the future, please file separate task for each issue, thanks.

abi_ triaged this task as Medium priority.Nov 9 2020, 6:40 AM

Change 639511 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] GettextFFS: Fix PHP 7.4 warnings

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

Change 639512 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] export.php: Add trailing newlines to some output messages

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

I'm calling this done with implicit testing. It's tagged for next MLEB so we can double check before the next release.