Page MenuHomePhabricator

MediaWiki passes nulls to non-null parameters of PHP internal functions
Open, Needs TriagePublicBUG REPORT

Description

It's deprecated in PHP 8.1, so in a lot of places, one could see notices like urlencode(): Passing null to parameter #1 ($string) of type string is deprecated.

Current unique issues from composer phpunit:unit only:

MediaWiki\Tests\Rest\Handler\UserContributionsHandlerTest::testThatParametersAreHandledCorrectlyForMeEndpoint with data set #0 (array())
urlencode(): Passing null to parameter #1 ($string) of type string is deprecated

tests/phpunit/unit/includes/Rest/Handler/HandlerTestTrait.php:62
includes/Rest/Handler.php:103
includes/Rest/Handler/UserContributionsHandler.php:92
includes/Rest/Handler/UserContributionsHandler.php:31
tests/phpunit/unit/includes/Rest/Handler/HandlerTestTrait.php:151
tests/phpunit/unit/includes/Rest/Handler/UserContributionsHandlerTest.php:175
tests/phpunit/MediaWikiUnitTestCase.php:108
SiteConfigurationTest::testSiteFromDb
str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

includes/SiteConfiguration.php:515
tests/phpunit/unit/includes/SiteConfigurationTest.php:136
tests/phpunit/MediaWikiUnitTestCase.php:108
FileBackendGroupTest::testGuessMimeInternal with data set "No extension" ('foo', null, null, null, null)
strlen(): Passing null to parameter #1 ($string) of type string is deprecated

tests/phpunit/unit/includes/filebackend/FileBackendGroupTestTrait.php:413
tests/phpunit/MediaWikiUnitTestCase.php:108
  • This test shouldn't be marked as unity at all, it depends on wfExpandUrl() and therefore $wgServer.
HttpRequestFactoryTest::testCreate
substr(): Passing null to parameter #1 ($string) of type string is deprecated

includes/GlobalFunctions.php:782
includes/GlobalFunctions.php:490
includes/http/MWHttpRequest.php:101
includes/http/GuzzleHttpRequest.php:62
includes/http/HttpRequestFactory.php:120
tests/phpunit/unit/includes/http/HttpRequestFactoryTest.php:91
tests/phpunit/MediaWikiUnitTestCase.php:108

Event Timeline

Change 715313 had a related patch set uploaded (by MaxSem; author: MaxSem):

[mediawiki/core@master] SiteConfiguration: Don't pass null to str_replace()

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