Page MenuHomePhabricator

Fix Undefined index: id & timestamp in MediaWiki's Import.php
Closed, ResolvedPublic


Notice: Undefined index: id in C:\SMWPLUS\htdocs\mediawiki\includes\Import.php on line 548

Notice: Undefined index: timestamp in C:\SMWPLUS\htdocs\mediawiki\includes\Import.php on line 551

these messages above are generated with a very simple <page> element one without an <id> or <timestamp> child element.

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:05 AM
bzimport set Reference to bz32876.

I have strict errror reporting turned on.

Could you provide a sample file to produce the E_STRICT errors?

I have had a similar experience with:
php importDump.php ukwikimedia-20130608-pages-logging.xml.gz
5397 (370.49 revs/sec)
5398 (370.50 revs/sec)
5399 (370.52 revs/sec)
PHP Notice: Undefined index: params in /var/www/wiki/w/includes/Import.php on line 545
PHP Notice: Undefined index: logtitle in /var/www/wiki/w/includes/Import.php on line 546
WikiRevision given a null title in import. You may need to adjust $wgLegalTitleChars.
#0 /var/www/wiki/w/includes/Import.php(546): WikiRevision->setTitle(NULL)
#1 /var/www/wiki/w/includes/Import.php(528): WikiImporter->processLogItem(Array)
#2 /var/www/wiki/w/includes/Import.php(466): WikiImporter->handleLogItem()
#3 /var/www/wiki/w/maintenance/importDump.php(286): WikiImporter->doImport()
#4 /var/www/wiki/w/maintenance/importDump.php(245): BackupReader->importFromHandle(Resource id #75)
#5 /var/www/wiki/w/maintenance/importDump.php(95): BackupReader->importFromFile('/tmp/ukwikimedi...')
#6 /var/www/wiki/w/maintenance/doMaintenance.php(110): BackupReader->execute()
#7 /var/www/wiki/w/maintenance/importDump.php(291): require_once('/var/www/wiki/w...')
#8 {main}

In my case, it seems the XML file has an entry (corrupted?) with a NULL title. To workaround this, I just return if non title in ImportDump.php

private function processLogItem( $logInfo ) {

if ( ! $logInfo['logtitle'] ) {

They aren't corrupted, they're gone:

    <username>Andrew Gray</username>
  <text deleted="deleted" />
    <username>Andrew Gray</username>
  <text deleted="deleted" />
    <username>Andrew Gray</username>
  <comment>1 revision restored</comment>
  <text deleted="deleted" />

Obviously the failure to handle these gracefully is a bug.

WikiImporter doesn't know the meaning of grace...

Aklapper renamed this task from Undefined index: id & timestamp to Fix Undefined index: id & timestamp in MediaWiki's Import.php.Dec 3 2015, 5:39 PM
Aklapper set Security to None.
TTO removed TTO as the assignee of this task.Dec 6 2015, 11:39 AM

Georggi did some work on this, but I can't remember why it isn't linked to this task.

@Pranavmk98: It would be worth testing whether there is actually anything left to fix here :)

All right; how do I reproduce the error?

Aklapper claimed this task.