Handle missing namespace prefix in XML dumps more gracefully
authorThis, that and the other <at.light@live.com.au>
Mon, 26 Dec 2016 01:58:16 +0000 (12:58 +1100)
committerTTO <at.light@live.com.au>
Sun, 1 Jan 2017 09:11:45 +0000 (09:11 +0000)
commitef8bc825c6614a1687c7593d4beb0ebe24a1ada4
tree7c3fb42cfd61f9090e1bd3a1773791f07bd6098e
parentc3bdadc7a6d2634462a226e928af0df1d3034540
Handle missing namespace prefix in XML dumps more gracefully

If an XML dump of a wiki is exported using dumpBackup.php, and there are
pages in a namespace that is not registered (perhaps because of a missing
extension), they will appear in the dump in the form

<page> ... <title>PageTitle</title> <ns>1234</ns> ... </page>

This caused the ForeignTitle code to raise an undefined offset error,
because it assumed that the <title> element was of the form
"Namespace:PageTitle" when <ns> was nonzero. This assumption is not valid.

Now, the importation of such dumps will no longer throw errors and the
pages will be correctly imported, although possibly to unexpected
locations.

Bug: T114115
Change-Id: I0271435dc208e7ea118339584f8a0e359c96113a
includes/export/XmlDumpWriter.php
includes/title/NamespaceAwareForeignTitleFactory.php
tests/phpunit/includes/title/NamespaceAwareForeignTitleFactoryTest.php