Page MenuHomePhabricator

SF_AutoeditAPI.php: Call to a member function formHTML() on a non-object (null)
Closed, ResolvedPublic

Description

Seeing this error on translatewiki.net a lot lately. [no req] means that it is a command line request. First observed in 2016-01-17.

2016-01-20 08:13:32 translatewiki.net translatewiki_net-bw_: [90ee8af6] [no req] BadMethodCallException from line 933 of /srv/mediawiki/tags/2016-01-19_16:04:04/extensions/SemanticForms/includes/SF_AutoeditAPI.php: Call to a member function formHTML() on a non-object (null)
#0 /srv/mediawiki/tags/2016-01-19_16:04:04/extensions/SemanticForms/includes/SF_AutoeditAPI.php(115): SFAutoeditAPI->doAction()
#1 /srv/mediawiki/tags/2016-01-19_16:04:04/extensions/SemanticForms/specials/SF_FormEdit.php(92): SFAutoeditAPI->execute()
#2 /srv/mediawiki/tags/2016-01-19_16:04:04/extensions/SemanticForms/specials/SF_FormEdit.php(43): SFFormEdit->printForm(string, string, NULL)
#3 /srv/mediawiki/tags/2016-01-19_16:04:04/includes/specialpage/SpecialPage.php(384): SFFormEdit->execute(string)
#4 /srv/mediawiki/tags/2016-01-19_16:04:04/includes/specialpage/SpecialPageFactory.php(563): SpecialPage->run(string)
#5 /srv/mediawiki/tags/2016-01-19_16:04:04/includes/MediaWiki.php(280): SpecialPageFactory::executePath(Title, RequestContext)
#6 /srv/mediawiki/tags/2016-01-19_16:04:04/includes/MediaWiki.php(738): MediaWiki->performRequest()
#7 /srv/mediawiki/tags/2016-01-19_16:04:04/includes/MediaWiki.php(510): MediaWiki->main()
#8 /srv/mediawiki/tags/2016-01-19_16:04:04/index.php(43): MediaWiki->run()
#9 {main}

Event Timeline

Nikerabbit raised the priority of this task from to Needs Triage.
Nikerabbit updated the task description. (Show Details)
Nikerabbit subscribed.

Does this happen every time you go to a form, or only sometimes, or what?

The issue is that the $sfgFormPrinter global variable is not getting set. I assume this has to do with the recent change in the the code to use extension.json, but beyond that I don't know.

I thought it comes from the job queue since there is no url for the request, but it is definitely executing a special page as if it were a request...
I am not using extension.json for SemanticForms at this time.

Getting this as well when calling .../Special:FormEdit/SomeForm

902 is another possible line with a problem. PhpStorm sees it as undefined too

I guess, it's still a stub object

reedy@ubuntu64-web-esxi:/var/www/wiki/mediawiki/extensions/SemanticForms$ grep -R sfgFormPrinter * | grep "\$sfgFormPrinter ="
includes/SF_Utils.php:				$sfgFormPrinter = new StubObject( 'sfgFormPrinter', 'SFFormPrinter' );
includes/SF_Utils.php:			$sfgFormPrinter = new StubObject( 'sfgFormPrinter', 'SFFormPrinter' );
reedy@ubuntu64-web-esxi:/var/www/wiki/mediawiki/extensions/SemanticForms$

Where is it ever assigned to anything else?

Change 265376 had a related patch set uploaded (by Foxtrott):
Set global sfgFormPrinter

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

Change 265376 merged by jenkins-bot:
Set global sfgFormPrinter

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

Reedy assigned this task to Foxtrott.

Change 265382 had a related patch set uploaded (by Reedy):
Set global sfgFormPrinter

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

Change 265382 merged by jenkins-bot:
Set global sfgFormPrinter

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

Change 265426 had a related patch set uploaded (by Reedy):
Set global sfgFormPrinter

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

Change 265426 merged by jenkins-bot:
Set global sfgFormPrinter

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

Seems this is an extension registration problem since we are using a callback for sfgFormPrinter. We should add configuration project.

@Nikerabbit could you test this with mediawiki 1.24 to confirm that it is indeed an extension registration problem please.

Change 267161 had a related patch set uploaded (by Paladox):
Fix $sfgFormPrinter setting

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

@Nikerabbit I have now fixed the problem with the patch above. I have tested it and the errors go away with the patch.

Change 267161 merged by Yaron Koren:
Move defined( 'SF_VERSION' ) down to below wfLoadExtension call

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

@Nikerabbit does the patch above work for you it was merged and should resolve the problem now.

Should this be re closed as resolved now.