Page MenuHomePhabricator

"Invalid or virtual namespace -1 given" when submitting access request
Closed, ResolvedPublic

Description

When a user tries to submit an access request using

https://wikitech.wikimedia.org/wiki/Special:FormEdit/Tools_Access_Request

instead of filling the form, the error 'Invalid or virtual namespace -1 given.' is shown. Editing an existing request works as expected.

Event Timeline

valhallasw raised the priority of this task from to High.
valhallasw updated the task description. (Show Details)
valhallasw added subscribers: valhallasw, scfc, Andrew.
Restricted Application added a project: Cloud-Services. · View Herald TranscriptJun 24 2015, 7:18 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Sipun added a subscriber: Sipun.Jun 24 2015, 7:57 AM

I made it throw exceptions in SFAutoeditAPI::logMessage and got this on submission:

2015-06-24 13:47:35 silver labswiki exception INFO: [47b43124] /wiki/Special:FormEdit/Tools_Access_Request   Exception from line 1112 of /srv/mediawiki/php-1.26wmf10/extensions/SemanticForms/includes/SF_AutoeditAPI.php: Invalid or virtual namespace -1 given.
#0 /srv/mediawiki/php-1.26wmf10/extensions/SemanticForms/includes/SF_AutoeditAPI.php(117): SFAutoeditAPI->logMessage('Invalid or virt...', 0)
#1 /srv/mediawiki/php-1.26wmf10/extensions/SemanticForms/specials/SF_FormEdit.php(88): SFAutoeditAPI->execute()
#2 /srv/mediawiki/php-1.26wmf10/extensions/SemanticForms/specials/SF_FormEdit.php(43): SFFormEdit->printForm('Tools_Access_Re...', '', NULL)
#3 /srv/mediawiki/php-1.26wmf10/includes/specialpage/SpecialPage.php(384): SFFormEdit->execute('Tools_Access_Re...')
#4 /srv/mediawiki/php-1.26wmf10/includes/specialpage/SpecialPageFactory.php(582): SpecialPage->run('Tools_Access_Re...')
#5 /srv/mediawiki/php-1.26wmf10/includes/MediaWiki.php(285): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
#6 /srv/mediawiki/php-1.26wmf10/includes/MediaWiki.php(634): MediaWiki->performRequest()
#7 /srv/mediawiki/php-1.26wmf10/includes/MediaWiki.php(431): MediaWiki->main()
#8 /srv/mediawiki/php-1.26wmf10/index.php(41): MediaWiki->run()
#9 /srv/mediawiki/w/index.php(3): require('/srv/mediawiki/...')
#10 {main} {"private":false}

So the issue is somewhere under SFAutoeditAPI::doAction

Error is thrown in the internalAttemptSave call in doStore, even though $editor->getTitle() returns a title with namespace 498. It seems that it tries to call WikiPage::factory on the 'Special:FormEdit/Tools_Access_Request' title...

Changing the internalAttemptSave call to this:

$t = RequestContext::getMain()->getTitle();
RequestContext::getMain()->setTitle( $title );
                        $status = $editor->internalAttemptSave( $resultDetails, $bot );
RequestContext::getMain()->setTitle( $t );

Seems to fix it.

Krenair claimed this task.Jun 24 2015, 2:57 PM

That patch is live on the WMF cluster (on tin, uncommitted), we need to figure out what caused it to be necessary.

By coincidence, I just added a way to fix this to the SF documentation two days ago - see the 3rd item from the bottom here:

https://www.mediawiki.org/wiki/Extension:Semantic_Forms/Common_problems#Semantic_Forms_issues

It involves modifying or upgrading the ConfirmEdit extension.

So probably broke on wikitech due to T102652

Relevant commit in ConfirmEdit would be https://gerrit.wikimedia.org/r/#/c/209637/ but we have that, and ConfirmEdit was disabled shortly afterwards on wikitech in https://gerrit.wikimedia.org/r/#/c/218908/1 - so perhaps it is something else.

I think it's likely to be the SpamBlacklist code. AbuseFilter would've already been on, but SpamBlacklist was newly enabled.

Yeah. Disabled the SemanticForms live hack I had in place, turned off SpamBlacklist on labswiki. It still works, so the issue is those two extensions not playing nicely.

Okay, it's good to know that this problem also happens with just SF and SpamBlacklist - I didn't know that. I'm guessing it's something similar in the SpamBlacklist code causing the error; although maybe your change to the SF code is just as good a solution.

I'm not sure there is a better way around it in SB. EditPage doesn't give you the title of the page being edited in this hook (or the EditPage object with which you could find the title), you'd only be able to get the context title (so... title being requested, i.e. Special:EditForm/something). I'm going to upload a patch to SF which sets the context title.

Change 220622 had a related patch set uploaded (by Alex Monk):
Set context title when editing other pages

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

Change 220623 had a related patch set uploaded (by Alex Monk):
Set context title when editing other pages

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

Change 220622 abandoned by Alex Monk:
Set context title when editing other pages

Reason:
No longer a useful branch, see master cherry-pick

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

Change 220623 merged by jenkins-bot:
Set context title when editing other pages

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

Change 220765 had a related patch set uploaded (by Alex Monk):
Set context title when editing other pages

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

Change 220765 merged by jenkins-bot:
Set context title when editing other pages

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

Krenair closed this task as Resolved.Jun 25 2015, 3:13 PM
Krenair added a subscriber: Foxtrott.

And also deployed to wikitech. Thanks for reviewing this @Yaron_Koren and @Foxtrott.