|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-02-01 13:12 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 17:00:01 2025 UTC |
Description: ------------ When using php://filter with xinclude an errornous file:// uri is generated and let's the xinclude fail. Reproduce code: --------------- test.php -------- <?php echo '<pre>'; class TestFilter extends PHP_User_Filter { public function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $consumed += $bucket->datalen; stream_bucket_append($out, $bucket); } return PSFS_PASS_ON; } } stream_filter_register('testfilter', 'TestFilter'); $doc = new DomDocument; $doc->load("php://filter/read=testfilter/resource=file://".dirname(__FILE__)."/test1.xml"); $doc->xinclude(); echo "works!"; test1.xml --------- <?xml version="1.0" encoding="UTF-8"?> <foo> <xi:include href="test2.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> </foo> test2.xml --------- <?xml version="1.0" encoding="UTF-8"?> <bar>baz</bar> Expected result: ---------------- "works!" Actual result: -------------- Warning: DOMDocument::xinclude(php://filter/read=testfilter/resource=file%3A/path /to/test2.xml): failed to open stream: No such file or directory in /path/to/test.php on line 18 ^- should be ":" and there are two slashes missing Warning: DOMDocument::xinclude(): I/O warning : failed to load external entity "php://filter/read=testfilter/resource=file%3A/path/to/test2.xml" in /path/to/test.php on line 18 Warning: DOMDocument::xinclude(): could not load php://filter/read=testfilter/resource=file%3A/path/to/test2.xml, and no fallback was found in /path/to/test.php on line 18