Page MenuHomePhabricator

"unexpected NAN value was coerced to string" PHP warning from LanguageIntegrationTest::testParseFormattedNumber `assertEquals` call
Closed, ResolvedPublicBUG REPORT

Description

Currently, running composer phpunit -- --filter "LanguageIntegrationTest::testParseFormattedNumber" using PHP 8.5 (on mediawiki/core, 3b065a367e9e) results in the following error:

1) MediaWiki\Tests\Language\LanguageIntegrationTest::testParseFormattedNumber with data set #11 ('en', NAN)
unexpected NAN value was coerced to string

/[path]/tests/phpunit/includes/Language/LanguageIntegrationTest.php:2142
=== Logs generated by test case
[...]
===

The line of code in question (tests/phpunit/includes/Language/LanguageIntegrationTest.php:2142) is:

		$this->assertEquals( $number, $normalisedNum );

From discussion at https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1228117/comment/e8a0151d_c2549986/, it appears that this may be a PHP 8.5 compatibility issue with PHPUnit itself, rather than with MediaWiki code/tests. (Thanks for investigating it, @Ammarpad!!)
This task exists to track this issue downstream.

Upstream link: https://github.com/sebastianbergmann/phpunit/issues/6479

Event Timeline

Umherirrender subscribed.

Upstream fixed this and released a new version

After Upgrading sebastian/comparator (4.0.9 => 4.0.10) it works

Yep, a composer update fixes it now :)
(Note to self: We don't need to update anything in MediaWiki's composer.json, as the version of PHPUnit we're using allows "sebastian/comparator": "^4.0.8".)