ID: 43312
Updated by: [EMAIL PROTECTED]
Reported By: php at benjaminschulz dot com
-Status: Assigned
+Status: Wont fix
Bug Type: DOM XML related
PHP Version: 5.3CVS-2007-11-16 (CVS)
Assigned To: chregu
New Comment:
PHP URL handling for streams is not fully compatible with libxml2 URL
handling and canonicalization routines.
Workaround is to use a relative path for that case:
php://filter/read=testfilter/resource=./test1.xml
Previous Comments:
------------------------------------------------------------------------
[2007-11-16 13:42:49] php at benjaminschulz dot com
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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43312&edit=1