Page MenuHomePhabricator

LoginSignupSpecialPage::getFakeTemplate() litters debug log with QuickTemplate complaints
Closed, DeclinedPublic

Description

Whenever getFakeTemplate() is called, it creates a FakeTemplate object (subclass of QuickTemplate) without a config object. QuickTemplate complains:

		if ( $config === null ) {
			wfDebug( __METHOD__ . ' was called with no Config instance passed to it' );
			$config = MediaWikiServices::getInstance()->getMainConfig();
		}

This looks like it just wants a config object, hopefully the right one. For a FakeTemplate, this is probably fine, but the FakeTemplate should pass in the config object to quiet this thing down.

Event Timeline

Change 404894 had a related patch set uploaded (by MarkAHershberger; owner: MarkAHershberger):
[mediawiki/core@master] Stop QuickTemplate from complaining in the debug logs so much

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

BlueSpiceFoundation/includes/skins/BsBaseTemplate.php also seems to call it without anything

I wonder if the debug log line could just be removed as a wider fix

The line was added on Aug 8, 2014 by @Legoktm: https://gerrit.wikimedia.org/r/#/c/152859/

It was +1'd by @Jdlrobson and +2'd by @Addshore.

If the intent was to convince people to make sure they passed a Config object, then it should really throw an exception. If it doesn't matter, then I'd like to remove the debug message.

I agree that removing the log statement is the preferable approach, since it isn't an error. In the absence of the config being passed in, it defaults to the main config, which is perfectly reasonable. This behavior should be documented in the function header comment.

I agree that removing the log statement is the preferable approach, since it isn't an error. In the absence of the config being passed in, it defaults to the main config, which is perfectly reasonable. This behavior should be documented in the function header comment.

Updated patch accordingly.

The goal is to slowly migrate to dependency injection, but throwing an exception would have been a pretty big breaking change. We should probably turn it into wfDeprecated(), and then in the future require passing a config instance. (that said, it's not obvious where QuickTemplate needs a config instance...)

Change 404894 abandoned by markahershberger:
Stop QuickTemplate from complaining in the debug logs so much

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

@MarkAHershberger Is this still a problem? If not, the task should be closed.

I'm not dealing with this right now, so I'll close it. If it annoys me in the future, I have something to refer to.