weirdgloop / mediawiki-extensions-SearchDigest

Displays the most popular failed wiki searches in a special page, Special:SearchDigest.
GNU General Public License v3.0
1 stars 7 forks source link

PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated upon accessing Special:SearchDigest #20

Closed lakejason0 closed 1 month ago

lakejason0 commented 3 months ago
PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/wwwroot/podcast/includes/title/MediaWikiTitleCodec.php on line 364

This happens when visiting Special:SearchDigest. MediaWiki 1.42.1, using latest commit. Site language is zh.

lakejason0 commented 3 months ago

My report is here, just in case. Whether there are entries in this special page would nevertheless cause this warning, it just happens at any access to the page. https://lakeus.xyz/wiki/Special:SearchDigest

lakejason0 commented 3 months ago

Tried to print stack trace:

#0 /www/wwwroot/podcast/includes/title/Title.php(2754): MediaWiki\Title\MediaWikiTitleCodec->splitTitleString(NULL, 0)
#1 /www/wwwroot/podcast/includes/title/Title.php(658): MediaWiki\Title\Title->secureAndSplit(NULL)
#2 /www/wwwroot/podcast/extensions/SearchDigest/src/SpecialSearchDigest.php(85): MediaWiki\Title\Title::makeTitleSafe(0, NULL)
#3 /www/wwwroot/podcast/includes/specialpage/SpecialPage.php(719): MediaWiki\Extension\SearchDigest\SpecialSearchDigest->execute(NULL)
#4 /www/wwwroot/podcast/includes/specialpage/SpecialPageFactory.php(1669): MediaWiki\SpecialPage\SpecialPage->run(NULL)
#5 /www/wwwroot/podcast/includes/actions/ActionEntryPoint.php(504): MediaWiki\SpecialPage\SpecialPageFactory->executePath('...', Object(MediaWiki\Context\RequestContext))
#6 /www/wwwroot/podcast/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest()
#7 /www/wwwroot/podcast/includes/MediaWikiEntryPoint.php(199): MediaWiki\Actions\ActionEntryPoint->execute()
#8 /www/wwwroot/podcast/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
lakejason0 commented 3 months ago

https://github.com/weirdgloop/mediawiki-extensions-SearchDigest/blob/6a6d1592d992d1168d4852b629bc625ce6aa727b/src/SpecialSearchDigest.php#L85

I don't get the ->getRawVal( 'prefix' ) thing but it definitely could be NULL. https://github.com/wikimedia/mediawiki/blob/e74bec31e9f751d3510fb201e6d4f6194e8020e6/includes/Request/WebRequest.php#L499 Maybe check if it's null? What does this do?