Universal-Omega / DynamicPageList3

GNU General Public License v3.0
18 stars 22 forks source link

DB profiling code breaks on runtime #170

Open osnard opened 2 years ago

osnard commented 2 years ago

DynamicPageList3 version: 3.4.5 MediaWiki version: 1.35.6 PHP version: 7.4.28

List of steps to reproduce TBH, not sure about how to produce. It was reported to me and I just wanted to share my findings here.

What happens?: In some cases (sorry, I don't have more info right now) an exception is thrown: imageimage

I have investigated the code and came across https://github.com/Universal-Omega/DynamicPageList3/blob/3.4.5/includes/Query.php#L366-L367

Apparently a new Parser object is being created using MediaWikiServices::getParser. ParserFactory::create is invoked, which does not set a Title object. In such cases Parser::getTitle can actually return null (https://github.com/wikimedia/mediawiki/blob/1.35.6/includes/parser/Parser.php#L1006-L1008)

But the code does not check for null.

It looks like these actions are only performed to create some marker for DB profiling. Should I provide a patch that removes/alters the code?

Universal-Omega commented 2 years ago

Should I provide a patch that removes/alters the code?

Definitely welcome, if not I can in a little bit also.