Steps to replicate the issue:
- Make sure you didn't disable PHP deprecation warnings, and that you have a way to see them.
- Make sure you have the bundled PageImages extension enabled, and Cargo installed and enabled.
- Visit the PageValues special page implemented by Cargo, e.g.: /wiki/Special:PageValues/SomeTitle.
- Alternatively to the last point, this also works: /w/index.php?title=SomeTitle&action=pagevalues.
(Either way, the Cargo special page PageValues is invoked with the given page title as a "parameter" of sorts.)
What happens?:
The following deprecation warning is logged:
Use of MediaWiki\Parser\Parser::getPage without a Title set was deprecated in MediaWiki 1.34. [Called from PageImages\Hooks\ParserFileProcessingHookHandlers::onParserModifyImageHTML in /path/to/mw/extensions/PageImages/includes/Hooks/ParserFileProcessingHookHandlers.php at line 110]
What should have happened instead?:
I believe no deprecation warning should be logged, but I'm not entirely sure what's going on; see below for as far as my investigation went.
Software version:
MW 1.43.5 with the corresponding PageImages version, and latest Cargo release at this time (3.8.4).
https://bg3.wiki/wiki/Special:Version
Judging by the source code, I believe this issue probably still exists in the latest version of MediaWiki & PageImages, but I can't be sure because I don't have an environment where I can test it.
Other information:
I've traced the cause of this faulty(?) warning as follows, though I couldn't get to the root cause:
- PageImages calls $parser->getPage() here: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/PageImages/+/refs/heads/master/includes/Hooks/ParserFileProcessingHookHandlers.php#90 (This would be line 110 in the REL1_43 branch; it's line 90 on master right now.)
- That function checks if ( $this->mTitle->isSpecial( 'Badtitle' ) ) { ... }: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/includes/parser/Parser.php#968
- I believe that if statement should fail, since we are clearly in Special:PageValues which is a valid special page implemented by Cargo. However...
- The Title::isSpecial( $name ) implementation seems to call SpecialPageFactory::resolveAlias() with $this->mDbkeyform: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/includes/title/Title.php#1254 (At this point, I'm not sure what the Title object has in its mDbkeyform field.)
- That method, SpecialPageFactory::resolveAlias(), is just meant to split e.g. PageValues/SomeTitle into PageValues and SomeTitle, but instead it returns Badtitle as the first value (and Missing as the second; see below).
- The reason for that appears to be that the result of SpecialPageFactory::getAliasList() must be mapping PageValues to Badtitle for some reason? Or does $title->mDbkeyvalue not contain PageValues/SomeTitle at this point? I don't know; this is as far as I got.
- Note that after the if statement above passes, there's a further call to SpecialPageFactory::resolveAlias() but this time getting the second value it returns; this ends up being 'Missing' instead of the actual title.
Here's Cargo's implementation of Special:PageValues: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/Cargo/+/refs/heads/master/includes/specials/CargoPageValues.php
I can't tell if the problem is with PageImages, Cargo, or MW core.