Page MenuHomePhabricator

maint script importTextFile.php doesn't set the title for the context
Closed, ResolvedPublic

Description

If a parserhook tries to get the title from the request context (as the UserFunctions extension does) then that will cause importTextFile.php to fail:

PHP Fatal error: Call to a member function getNamespace() on a non-object in /vagrant/mediawiki/extensions/UserFunctions/UserFunctions.php on line 84
PHP Stack trace:
PHP 1. {main}() /vagrant/mediawiki/maintenance/importTextFile.php:0
PHP 2. WikiPage->doEdit() /vagrant/mediawiki/maintenance/importTextFile.php:61
PHP 3. WikiPage->prepareTextForEdit() /vagrant/mediawiki/includes/WikiPage.php:1290
PHP 4. Parser->preSaveTransform() /vagrant/mediawiki/includes/WikiPage.php:1520
PHP 5. Parser->startParse() /vagrant/mediawiki/includes/parser/Parser.php:4305
PHP 6. Parser->clearState() /vagrant/mediawiki/includes/parser/Parser.php:4552
PHP 7. Parser->firstCallInit() /vagrant/mediawiki/includes/parser/Parser.php:249
PHP 8. wfRunHooks() /vagrant/mediawiki/includes/parser/Parser.php:237
PHP 9. Hooks::run() /vagrant/mediawiki/includes/GlobalFunctions.php:3859
PHP 10. call_user_func_array:{/vagrant/mediawiki/includes/Hooks.php:216}() /vagrant/mediawiki/includes/Hooks.php:216
PHP 11. UserFunctions_HookStub->registerParser() /vagrant/mediawiki/includes/Hooks.php:216

This can be fixed by calling RequestContext::getMain()->setTitle( $title ) at the right place.


Version: 1.23.0
Severity: normal

Details

Reference
bz62467

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 2:56 AM
bzimport set Reference to bz62467.

Change 117816 had a related patch set uploaded by MarkAHershberger:
Set a title for the context during import on the cli

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

Note that I would like to get this backported

Change 117816 merged by jenkins-bot:
Set a title for the context during import on the cli

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

Change 120319 had a related patch set uploaded by MarkAHershberger:
Set a title for the context during import on the cli

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

Change 120320 had a related patch set uploaded by MarkAHershberger:
Set a title for the context during import on the cli

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

Change 120321 had a related patch set uploaded by MarkAHershberger:
Set a title for the context during import on the cli

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

patch against core has been merged. I've cherry picked the backports and am adding Markus as CC so he can merge them during this month's point release.

Change 120319 merged by jenkins-bot:
Set a title for the context during import on the cli

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

Change 120320 merged by Mglaser:
Set a title for the context during import on the cli

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

Change 120321 merged by Mglaser:
Set a title for the context during import on the cli

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