I first noticed these test failures on the PHP 8.4 'check experimental' test for this DNM patch to mediawiki/vendor (that pulls in the originally-proposed fix for T409283).
However, I can also reproduce this locally when running the master branch of mediawiki/core (as long as I have authoritative class maps disabled, for the reasons described in that task).
Steps to replicate the issue
- Have a local MediaWiki development environment
- Update Composer dependencies using composer update
- Run composer phpunit:entrypoint -- --filter "(Contributions|ChangesList)Test"
What happens?
There were 5 errors: 1) ChangesListTest::testInsertLogEntry TypeError: PHPUnit\Framework\Assert::assertStringContainsString(): Argument #2 ($haystack) must be of type string, null given, called in /workspace/src/tests/phpunit/includes/RecentChanges/ChangesListTest.php on line 78 /workspace/src/tests/phpunit/includes/RecentChanges/ChangesListTest.php:78 === Logs generated by test case [...] === 2) MediaWiki\Tests\Specials\SpecialContributionsTest::testExecuteNoResultsForIPTarget with data set "Temporary accounts not enabled" (false, 'contributions-title') TypeError: PHPUnit\Framework\Assert::assertStringNotContainsString(): Argument #2 ($haystack) must be of type string, null given, called in /workspace/src/tests/phpunit/includes/Specials/SpecialContributionsTest.php on line 210 /workspace/src/tests/phpunit/includes/Specials/SpecialContributionsTest.php:210 === Logs generated by test case [...] === 3) MediaWiki\Tests\Specials\SpecialContributionsTest::testExecuteNoResultsForIPTarget with data set "Temporary accounts enabled" (true, 'contributions-title-for-ip-wh...nabled') TypeError: PHPUnit\Framework\Assert::assertStringNotContainsString(): Argument #2 ($haystack) must be of type string, null given, called in /workspace/src/tests/phpunit/includes/Specials/SpecialContributionsTest.php on line 210 /workspace/src/tests/phpunit/includes/Specials/SpecialContributionsTest.php:210 === Logs generated by test case [...] === 4) MediaWiki\Tests\Specials\SpecialDeletedContributionsTest::testExecuteNoResultsForIPTarget with data set "Temporary accounts not enabled" (false, 'deletedcontributions-title') TypeError: PHPUnit\Framework\Assert::assertStringNotContainsString(): Argument #2 ($haystack) must be of type string, null given, called in /workspace/src/tests/phpunit/includes/Specials/SpecialDeletedContributionsTest.php on line 80 /workspace/src/tests/phpunit/includes/Specials/SpecialDeletedContributionsTest.php:80 === Logs generated by test case [...] === 5) MediaWiki\Tests\Specials\SpecialDeletedContributionsTest::testExecuteNoResultsForIPTarget with data set "Temporary accounts enabled" (true, 'deletedcontributions-title-fo...nabled') TypeError: PHPUnit\Framework\Assert::assertStringNotContainsString(): Argument #2 ($haystack) must be of type string, null given, called in /workspace/src/tests/phpunit/includes/Specials/SpecialDeletedContributionsTest.php on line 80 /workspace/src/tests/phpunit/includes/Specials/SpecialDeletedContributionsTest.php:80 === Logs generated by test case [...] ===
(copied from https://integration.wikimedia.org/ci/job/quibble-for-mediawiki-core-vendor-mysql-php84/12/console, but I get the same errors locally)
Software version
mw/core @ 4676165fa46f
Other information/Notes
Potentially-relevant lines from the test files in question:
// Get the log entry HTML line and check that the wrapping element is present. $html = $changesList->insertLogEntry( $recentChange ); $htmlElement = DOMUtils::parseHTML( $html ); $wrappingElement = DOMCompat::querySelector( $htmlElement, '.mw-changeslist-log-entry.class-added-by-hook' ); $this->assertNotNull( $wrappingElement ); $lineInnerHtml = $wrappingElement->nodeValue; $this->assertStringContainsString( '(logentry-delete-delete', $lineInnerHtml );
[ $html ] = $this->executeSpecialPage( '4.3.2.1', null, null, null, true ); $specialPageDocument = DOMUtils::parseHTML( $html ); $contentHtml = DOMCompat::querySelector( $specialPageDocument, '#content' )->nodeValue; $this->assertStringNotContainsString( 'mw-pager-body', $contentHtml );
[ $html ] = $this->executeSpecialPage( '127.0.0.1', null, null, self::$sysop, true ); $specialPageDocument = DOMUtils::parseHTML( $html ); $contentHtml = DOMCompat::querySelector( $specialPageDocument, '#content' )->nodeValue; $this->assertStringNotContainsString( 'mw-pager-body', $contentHtml );
I'm assuming that this should maybe be fixed within Parsoid due to (what seems like) breakage of back-compatibility from PHP 8.4 onwards; but also tagging the components that have failing tests for visibility.