Page MenuHomePhabricator

With subpages disabled for user pages, I get error: "Tried to load block with invalid type"
Closed, ResolvedPublic

Description

When subpages are disabled for user pages, I get the following error on user subpages:

Tried to load block with invalid type

Backtrace:

#0 C:\wamp\www\mw\includes\Block.php(1010): Block->newLoad('Robin/subpage')
#1 C:\wamp\www\mw\includes\Article.php(646): Block::newFromTarget(NULL, 'Robin/subpage')
#2 C:\wamp\www\mw\includes\Article.php(570): Article->getRobotPolicy('view')
#3 C:\wamp\www\mw\includes\Wiki.php(458): Article->view()
#4 C:\wamp\www\mw\includes\Wiki.php(230): MediaWiki->performAction(Object(Article))
#5 C:\wamp\www\mw\includes\Wiki.php(606): MediaWiki->performRequest()
#6 C:\wamp\www\mw\includes\Wiki.php(517): MediaWiki->main()
#7 C:\wamp\www\mw\index.php(57): MediaWiki->run()
#8 {main}


Version: 1.20.x
Severity: normal

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 21 2014, 11:34 PM
bzimport set Reference to bz29797.
bzimport added a subscriber: Unknown Object (MLST).

Working patch

The callback indicates that MW is running a quick check on the user who "owns" the page to decide if it should be indexed or not by search bots (because the user viewing the page could be a search bot).

Since subpages are now turned off, MW assumes that the user "owning" the page is called "Robin/subpage".

As usernames should never contain a forwards slash, it should be simple enough to check for the presence of a forwards slash, and, if it is found, conclude that the username being passed is in fact not a username at all but an old subpage. The correct username can then be extracted.

This is what the attached patch does.

Attached:

Thank you for the patch.

I applied it in r91886.

Change 971344 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/core@master] Remove weird special case from BlockUtils::parseBlockTarget

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

Change 971344 merged by jenkins-bot:

[mediawiki/core@master] Remove weird special case from BlockUtils::parseBlockTarget

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