Page MenuHomePhabricator

Make MediaWiki compatible with PHP 8
Open, Needs TriagePublic

Description

This is a base task for PHP 8.0 support.

Details

ProjectBranchLines +/-Subject
mediawiki/coremaster+4 -3
mediawiki/coreREL1_35+3 -2
mediawiki/vendorREL1_35+4 K -4 K
mediawiki/coreREL1_35+1 -1
mediawiki/coremaster+1 -1
mediawiki/coreREL1_35+4 -3
mediawiki/coreREL1_35+1 -1
mediawiki/coremaster+4 -0
mediawiki/coreREL1_35+4 -0
mediawiki/coremaster+1 -1
integration/configmaster+1 -0
mediawiki/coremaster+2 -1
mediawiki/vendormaster+4 K -4 K
mediawiki/services/parsoidREL1_35+1 -1
mediawiki/extensions/GoogleLoginmaster+49 -34
mediawiki/extensions/Translatemaster+14 -14
mediawiki/extensions/Expressionsmaster+21 -20
mediawiki/services/parsoidmaster+1 -1
mediawiki/coreREL1_35+9 -9
mediawiki/coreREL1_35+183 -0
mediawiki/coremaster+2 -2
mediawiki/coremaster+9 -9
mediawiki/coreREL1_35+1 -1
mediawiki/coremaster+1 -1
mediawiki/coremaster+11 -6
mediawiki/coremaster+5 -3
mediawiki/coremaster+2 -3
mediawiki/coremaster+22 -4
mediawiki/coremaster+20 -19
mediawiki/coremaster+1 -1
mediawiki/coremaster+24 -10
Show related patches Customize query in gerrit

Related Objects

StatusSubtypeAssignedTask
OpenNone
ResolvedJdforrester-WMF
ResolvedFlorian
ResolvedReedy
OpenNone
ResolvedTK-999
ResolvedNone
ResolvedJdforrester-WMF
ResolvedAddshore
ResolvedLucas_Werkmeister_WMDE
ResolvedLucas_Werkmeister_WMDE
ResolvedItamarWMDE
ResolvedSilvan_WMDE
ResolvedTonina_Zhelyazkova_WMDE
ResolvedLucas_Werkmeister_WMDE
ResolvedDaimona
ResolvedReedy
ResolvedReedy

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 643764 had a related patch set uploaded (by TK-999; owner: TK-999):
[mediawiki/core@master] tests: Fix queryFlags parameter type in RevisionStoreDbTestBase

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

Change 643764 merged by jenkins-bot:
[mediawiki/core@master] tests: Fix queryFlags parameter type in RevisionStoreDbTestBase

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

Some of these want backporting to 1.35 as we want that to support php 8

Change 643761 merged by jenkins-bot:
[mediawiki/core@master] tests: Fix method signature mismatches

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

@Reedy Currently I'm not sure if we can even get the test suite to run on PHP 8 without upgrading PHPUnit first (there are some errors from generated mock code). I monkey-patched PHPUnit 9 over master to work around that for now on my local machine.

More specifically, any PHPUnit mock/stub encountered by tests throws an error like:

1) ActorMigrationTest::testInsertRoundTrip with data set "normal" ('actormigration1', 'am1_user', 'am1_id', false)
ParseError: syntax error, unexpected token "match"

/Users/mateszabo/Wikia/mwdev/mediawiki/tests/phpunit/includes/ActorMigrationTest.php:545
/Users/mateszabo/Wikia/mwdev/mediawiki/tests/phpunit/MediaWikiIntegrationTestCase.php:437
/Users/mateszabo/Wikia/mwdev/mediawiki/maintenance/doMaintenance.php:106

on PHP 8 + MW master.

unexpected token "match"

Yea, see http://maettig.com/2020-09-21-prepare-for-php-8. Functions named match might be one of the bigger PHP 7→8 problems we have. I started renaming some already. Here is the rest: https://codesearch.wmcloud.org/search/?q=function%20match%5Cb&files=%5C.php%24. This doesn't cover Wikia codebases, unfortunately.

unexpected token "match"

Yea, see http://maettig.com/2020-09-21-prepare-for-php-8. Functions named match might be one of the bigger PHP 7→8 problems we have. I started renaming some already. Here is the rest: https://codesearch.wmcloud.org/search/?q=function%20match%5Cb&files=%5C.php%24. This doesn't cover Wikia codebases, unfortunately.

Yup, the problem is that the problematic code is within the mock code autogenerated by PHPUnit, so I don't see how it can be avoided without going through the hassle of upgrading PHPUnit (v9 brings another slew of breaking changes)

Relevant:

PHPUnit 9 is compatible with PHP8, but dropped PHP7.2 and older.

It looks like WordPress will be using PHPUnit 7 (or 8?) with patches for PHP8, rather than the approach we took in the past where we used multiple PHPUnit versions side-by-side with local traits to emulate the newer version on the old version.

Change 643485 had a related patch set uploaded (by Reedy; owner: TK-999):
[mediawiki/core@REL1_35] tests: Fix queryFlags parameter type in RevisionStoreDbTestBase

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

Change 643786 had a related patch set uploaded (by Reedy; owner: TK-999):
[mediawiki/core@REL1_35] tests: Fix method signature mismatches

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

Change 643786 abandoned by Reedy:
[mediawiki/core@REL1_35] tests: Fix method signature mismatches

Reason:
Neither of these are needed. One new file, other changes not in REL1_35, added in 6eea7d7ed51c4e04ef25e42b8f2021bc4cb10932

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

@Reedy Currently I'm not sure if we can even get the test suite to run on PHP 8 without upgrading PHPUnit first (there are some errors from generated mock code). I monkey-patched PHPUnit 9 over master to work around that for now on my local machine.

I still want to pro-actively want to backport them as we're making them; if they don't cause breaking changes etc (and obviously work on PHP 7). Means we don't have to find them later, or re-make them etc

Change 643485 merged by jenkins-bot:
[mediawiki/core@REL1_35] tests: Fix queryFlags parameter type in RevisionStoreDbTestBase

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

Change 643782 had a related patch set uploaded (by TK-999; owner: TK-999):
[mediawiki/services/parsoid@master] TestRunner: Fix base_convert() call on PHP 8

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

Change 643791 had a related patch set uploaded (by Reedy; owner: TK-999):
[mediawiki/services/parsoid@REL1_35] TestRunner: Fix base_convert() call on PHP 8

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

Change 643782 merged by jenkins-bot:
[mediawiki/services/parsoid@master] TestRunner: Fix base_convert() call on PHP 8

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

Change 640555 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/Translate@master] Make compatible with PHP8: can't use "match" any more

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

Change 640554 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/Expressions@master] Make compatible with PHP8: can't use "match" any more

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

Change 640554 merged by jenkins-bot:
[mediawiki/extensions/Expressions@master] Make compatible with PHP8: can't use "match" any more

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

Change 640555 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Make compatible with PHP8: can't use "match" any more

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

Change 645338 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/GoogleLogin@master] Make compatible with PHP8: can't use "match" any more

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

Does anyone know to which degrees MW 1.35 and master run on PHP 8.0? (I understand there is no official support)

Does anyone know to which degrees MW 1.35 and master run on PHP 8.0? (I understand there is no official support)

Master and REL1_35 (ie the branch, not 1.35.0) of MW core will be similar

I don't know if it's well tested, but it does seem "test" related code is probably more problematic than normal workflow.

Testing appreciated. Feel free to report bugs or submit changesets to fix issues

monolog/monolog 2.0.2 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement

Fun.

monolog/monolog 2.0.2 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement

Fun.

Heh. At least we're not on 1.25 anymore!

Change 645338 merged by jenkins-bot:
[mediawiki/extensions/GoogleLogin@master] Make compatible with PHP8: can't use "match" any more

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

Change 648330 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/vendor@master] Upgrade wikimedia/less.php from 3.0.0 to 3.1.0

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

Change 648331 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/core@master] Upgrade wikimedia/less.php from 3.0.0 to 3.1.0

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

Change 643791 merged by Legoktm:
[mediawiki/services/parsoid@REL1_35] TestRunner: Fix base_convert() call on PHP 8

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

Change 648330 merged by jenkins-bot:
[mediawiki/vendor@master] Upgrade wikimedia/less.php from 3.0.0 to 3.1.0

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

Change 648331 merged by Reedy:
[mediawiki/core@master] Upgrade wikimedia/less.php from 3.0.0 to 3.1.0

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

monolog/monolog 2.0.2 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement

Fun.

Exactly. Very "fun". That is my feedback so far: don't pin monolog and other dependencies, especially to something that cannot be installed with the latest PHP version. Or, at the very least, switch the pin to any more recent version than monolog 2.0.2, which all allow installation with PHP 8.

monolog/monolog 2.0.2 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement

Fun.

Exactly. Very "fun". That is my feedback so far: don't pin monolog and other dependencies, especially to something that cannot be installed with the latest PHP version. Or, at the very least, switch the pin to any more recent version than monolog 2.0.2, which all allow installation with PHP 8.

Doesn’t help when we have code in core that depends on classes in a 3rd party library, and we can’t easily support both versions when signatures change... so no point in letting you install it if it won’t work if you try to use it....

monolog/monolog 2.0.2 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement

Fun.

Exactly. Very "fun". That is my feedback so far: don't pin monolog and other dependencies, especially to something that cannot be installed with the latest PHP version.

Given that we've found everyone on Earth disagrees as to the exact semantics of SemVer in ways that have broken master and threatened the stability of production, including composer themselves, no.

Or, at the very least, switch the pin to any more recent version than monolog 2.0.2, which all allow installation with PHP 8.

Yes, that's the plan. :-) Unfortunately their support expanse comes at the expense of breaking changes that they don't consider breaking in their output, so we have to re-validate all the security logging etc. again.

Be happy were on 2.0 now too ;)

Change 656593 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[integration/config@master] Zuul: [mediawiki/core] Add composer (not vendor) experimental PHP 8.0 job

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

Change 656593 merged by jenkins-bot:
[integration/config@master] Zuul: [mediawiki/core] Add composer (not vendor) experimental PHP 8.0 job

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

Mentioned in SAL (#wikimedia-releng) [2021-01-17T03:44:33Z] <James_F> Zuul: [mediawiki/core] Add composer (not vendor) experimental PHP 8.0 job T248925

Change 657683 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/core@master] Set empty closures in DatabaseTest to fix php8 tests

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

Change 657713 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/core@master] Special:Contributions reports negative namespace error on php8

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

Change 657685 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/core@master] Fix constructor HashBagOStuff on non-numeric strings for php8

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

Change 657713 merged by jenkins-bot:
[mediawiki/core@master] Special:Contributions reports negative namespace error on php8

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

Change 660527 had a related patch set uploaded (by Reedy; owner: Umherirrender):
[mediawiki/core@REL1_35] Set empty closures in DatabaseTest to fix php8 tests

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

Change 660527 abandoned by Reedy:
[mediawiki/core@REL1_35] Set empty closures in DatabaseTest to fix php8 tests

Reason:

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

Change 660527 restored by Reedy:
[mediawiki/core@REL1_35] Set empty closures in DatabaseTest to fix php8 tests

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

Change 660527 merged by jenkins-bot:
[mediawiki/core@REL1_35] Set empty closures in DatabaseTest to fix php8 tests

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

Change 657683 merged by jenkins-bot:
[mediawiki/core@master] Set empty closures in DatabaseTest to fix php8 tests

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

Change 660530 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/core@REL1_35] Special:Contributions reports negative namespace error on php8

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

Change 660530 merged by jenkins-bot:
[mediawiki/core@REL1_35] Special:Contributions reports negative namespace error on php8

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

Change 657685 merged by jenkins-bot:
[mediawiki/core@master] objectcache: Fix non-numeric string check in HashBagOStuff for PHP 8

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

Change 660929 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/core@REL1_35] objectcache: Fix non-numeric string check in HashBagOStuff for PHP 8

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

Change 660626 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/core@master] Fix CacheTime::getCacheExpiry for php8

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

Change 660929 merged by jenkins-bot:
[mediawiki/core@REL1_35] objectcache: Fix non-numeric string check in HashBagOStuff for PHP 8

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

Change 660626 merged by jenkins-bot:
[mediawiki/core@master] Fix CacheTime::getCacheExpiry for php8

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

Change 661654 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/core@REL1_35] Fix CacheTime::getCacheExpiry for php8

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

Change 661654 merged by jenkins-bot:
[mediawiki/core@REL1_35] Fix CacheTime::getCacheExpiry for php8

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

Squashed a patch set together, which now passed for the composer job on master: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/662089

https://integration.wikimedia.org/ci/job/mediawiki-quibble-composer-mysql-php80-docker/16/console

That means: Closing the sub tasks should make it work for mediawiki/core as other failing tests are now passed


elasticsearch/elasticsearch needs update to also work on the vendor job (T271777)

Change 662100 had a related patch set uploaded (by Reedy; owner: Jforrester):
[mediawiki/vendor@REL1_35] Upgrade wikimedia/less.php from 3.0.0 to 3.1.0

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

Change 662055 had a related patch set uploaded (by Reedy; owner: Jforrester):
[mediawiki/core@REL1_35] Upgrade wikimedia/less.php from 3.0.0 to 3.1.0

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

Change 662100 merged by Reedy:
[mediawiki/vendor@REL1_35] Upgrade wikimedia/less.php from 3.0.0 to 3.1.0

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

Change 662055 merged by jenkins-bot:
[mediawiki/core@REL1_35] Upgrade wikimedia/less.php from 3.0.0 to 3.1.0

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