Page MenuHomePhabricator

ImportTest::testHandlePageContainsRedirect causes MWException: Cannot create InputStreamSource
Closed, ResolvedPublic

Description

  1. ImportTest::testHandlePageContainsRedirect with data set #1 ('<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.9/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.9/ http://www.mediawiki.org/xml/export-0.9.xsd" version="0.9" xml:lang="en"> <page> <title>Test</title> <ns>0</ns> <id>42</id> <revision> <id>421</id> <timestamp>2014-05-27T11:00:00Z</timestamp> <contributor> <username>Admin</username> <id>10</id> </contributor> <text xml:space="preserve" bytes="4">Abcd</text> <sha1>n7uomjq96szt60fy5w3x7ahf7q8m8rh</sha1> <model>wikitext</model> <format>text/x-wiki</format> </revision> </page>

</mediawiki>', NULL)
MWException: Cannot create InputStreamSource.

/usr/home/saper/public_html/pg/w/tests/phpunit/includes/ImportTest.php:16
/usr/home/saper/public_html/pg/w/tests/phpunit/includes/ImportTest.php:28
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/Framework/TestCase.php:976
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/Framework/TestCase.php:831
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/Framework/TestResult.php:648
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/Framework/TestCase.php:776
/usr/home/saper/public_html/pg/w/tests/phpunit/MediaWikiTestCase.php:141
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/Framework/TestSuite.php:775
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/Framework/TestSuite.php:745
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/Framework/TestSuite.php:705
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/Framework/TestSuite.php:705
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/Framework/TestSuite.php:705
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/TextUI/TestRunner.php:349
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/TextUI/Command.php:176
phar:///usr/share/php/phpunit/phpunit.phar/PHPUnit/TextUI/Command.php:129
/usr/share/php/phpunit/phpunit.phar:531

May be related to bug 72214, but that's a different message


Version: 1.25-git
Severity: normal

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:49 AM
bzimport set Reference to bz73283.
bzimport added a subscriber: Unknown Object (MLST).

Simple smoke test is failing here (need to have gerrit change 156446 installed to use print not print_r):

print ImportStreamSource::newFromFile('data:application/xml,<xml><p>Hi</p></xml>');

<Error, collected 1 error(s) on the way, no value set>
+------+---------------------------+------------------------------------------+

1importcantopen

+------+---------------------------+------------------------------------------+

So this was caused by gerrit change 134079 which introduced "Import Testing".

This little thing now requires the use of fopen() with stream wrappers, data URL and .... "allow_url_open" set to "On"

Do we require allow_url_open to be enabled now?

It seems to be an overkill for some simple thing like providing a test string to an XML parser.

But here I think a monster thing called includes/Import.php is to blame

gerritadmin wrote:

Change 172657 had a related patch set uploaded by saper:
Skip ImportTest if allow_url_fopen disabled

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

gerritadmin wrote:

Change 173222 had a related patch set uploaded by saper:
Use ImportStringSource for simple import sources

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

gerritadmin wrote:

Change 173222 abandoned by saper:
Use ImportStringSource for simple import sources

Reason:
Wrongly submitted

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

gerritadmin wrote:

Change 173223 had a related patch set uploaded by saper:
Use ImportStringSource for simple import sources

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

Change 182333 had a related patch set uploaded (by McIntireEvan):
Documented the Class ImportStringSource based on https://phabricator.wikimedia.org/T75283

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

Patch-For-Review

Change 172657 merged by jenkins-bot:
Skip ImportTest if allow_url_fopen disabled

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

Change 173223 had a related patch set uploaded (by saper):
Use ImportStringSource for simple import sources

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

Change 173223 merged by jenkins-bot:
Use ImportStringSource for simple import sources

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

Patch is merged. Please verify that this fixes the issue, and close the ticket if it does.