I tried to Special:Import mediawiki.org's API:Main_page to another wiki, including all templates and versions.
Every time I get a fatal error:
/w/index.php?title=Special:Import&action=submit \ ErrorException from line 126 of /srv/vagrant/mediawiki/includes/page/WikiPage.php: \ PHP Error: Argument 1 passed to WikiPage::factory() must be an instance of Title, null given #0 /srv/vagrant/mediawiki/includes/page/WikiPage.php(126): MWExceptionHandler::handleError() #1 /srv/vagrant/mediawiki/includes/Import.php(313): WikiPage::factory() #2 /srv/vagrant/mediawiki/includes/Import.php(445): WikiImporter->beforeImportPage() #3 /srv/vagrant/mediawiki/includes/Import.php(736): WikiImporter->pageCallback() #4 /srv/vagrant/mediawiki/includes/Import.php(566): WikiImporter->handlePage()
The title passed to the factory is $titleAndForeignTitle[0] in beforeImportPage(). I dumped it out and found after successfully passing an array for "Module:Template translation: to the factory, on the next invocation $titleAndForeignTitle is false, so $titleAndForeignTitle[0] is NULL and that's not a Title so the factory blows up.
I think the page failing to import is "Translations:API:Cross-site requests/Page display title/en". Trying to import that page alone from mediawikiwiki leads to the same error. Note this translated page is normally managed by Special:Translate.
WikiImporter's handlePage() detects a bad title, but proceeds to call beforeImportPage() anyway, and crash:
if ( !$title ) {
$badTitle = true;
$skip = true;
}
$this->pageCallback( $title );I think the code needs to skip the beforeImportPage() callback if $badTitle, and maybe Special:Translate needs to interpose on handling import/export of its NS_TRANSLATIONS namespace.