Clean up state of libxml on failed import.
authordaniel <daniel.kinzler@wikimedia.de>
Wed, 11 Feb 2015 11:06:25 +0000 (12:06 +0100)
committerDaniel Kinzler <daniel.kinzler@wikimedia.de>
Wed, 11 Feb 2015 11:27:21 +0000 (11:27 +0000)
commit766cb52048f01606db9a3b4b5c6eb95ba1e89591
treed7a7111914ae7627eabca2f81788a79d42173743
parent68aab7ca8bd2bf7271a2f69aff1e7a60ab88078b
Clean up state of libxml on failed import.

Make sure we always call XMLReader::close() to clean up libxml's internal state,
even if import fails with an exception. Otherwise, any subsequent attempt at importing
(or otherwise using an XMLReader) will fail with:

  XMLReader::open(): Unable to open source data

This is particularly annoying for unit tests which should be allowed to fail
without dragging down subsequent tests. Even more importantly, they may
explicitly be testing a failure case, which should not cause subsequent tests
to fail.

NOTE: Wikibase patch Id035ecebebb67 is blocked on this,
please re-check once this is merged.

Change-Id: I31c014df39aa11c11ded70050ef12a8e2c5fefc5
includes/Import.php