Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load xml as string from local file, fixes #3942 #4100

Merged
merged 2 commits into from Jun 3, 2015

Conversation

alcohol
Copy link
Member

@alcohol alcohol commented Jun 3, 2015

If the entity loader is disabled on a system, loading files, even from the local file system, is considered as external to the running php process, and thus not allowed by the libxml extension. Reading the file contents and loading the xml as a string is a valid alternative however.

Fixes #3942

If the entity loader is disabled on a system, loading files, even from
the local file system, is considered as external to the running php
process, and thus not allowed by the libxml extension. Reading the file
contents and loading the xml as a string is a valid alternative however.
@stof
Copy link
Contributor

stof commented Jun 3, 2015

👍

@alcohol
Copy link
Member Author

alcohol commented Jun 3, 2015

Modified the unit tests to simulate the scenario in which previously the PearPackageExtractor would fail. Tests failed with the fix reverted, pass with the fix.

/srv/git/github/composer (load-xml-as-string) $ vendor/bin/phpunit tests/Composer/Test/Downloader/PearPackageExtractorTest.php
PHPUnit 4.6.6 by Sebastian Bergmann and contributors.

Configuration read from /srv/git/github/composer/phpunit.xml.dist

EEE.

Time: 128 ms, Memory: 5.00Mb

There were 3 errors:

1) Composer\Test\Downloader\PearPackageExtractorTest::testShouldExtractPackage_1_0
simplexml_load_file(): I/O warning : failed to load external entity "/srv/git/github/composer/tests/Composer/Test/Downloader/Fixtures/Package_v1.0/package.xml"

/srv/git/github/composer/src/Composer/Downloader/PearPackageExtractor.php:140
/srv/git/github/composer/tests/Composer/Test/Downloader/PearPackageExtractorTest.php:27

2) Composer\Test\Downloader\PearPackageExtractorTest::testShouldExtractPackage_2_0
simplexml_load_file(): I/O warning : failed to load external entity "/srv/git/github/composer/tests/Composer/Test/Downloader/Fixtures/Package_v2.0/package.xml"

/srv/git/github/composer/src/Composer/Downloader/PearPackageExtractor.php:140
/srv/git/github/composer/tests/Composer/Test/Downloader/PearPackageExtractorTest.php:62

3) Composer\Test\Downloader\PearPackageExtractorTest::testShouldExtractPackage_2_1
simplexml_load_file(): I/O warning : failed to load external entity "/srv/git/github/composer/tests/Composer/Test/Downloader/Fixtures/Package_v2.1/package.xml"

/srv/git/github/composer/src/Composer/Downloader/PearPackageExtractor.php:140
/srv/git/github/composer/tests/Composer/Test/Downloader/PearPackageExtractorTest.php:85

FAILURES!
Tests: 4, Assertions: 1, Errors: 3.

Seldaek added a commit that referenced this pull request Jun 3, 2015
load xml as string from local file, fixes #3942
@Seldaek Seldaek merged commit c16ee53 into composer:master Jun 3, 2015
@alcohol alcohol deleted the load-xml-as-string branch September 13, 2016 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pear-pear.php.net packages install fails on Windows
3 participants