From: php at benjaminschulz dot com Operating system: PHP version: 5.3CVS-2007-11-16 (CVS) PHP Bug Type: DOM XML related Bug description: php://filter URIs get mangled and make xinclude() fail
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 bug report at http://bugs.php.net/?id=43312&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43312&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43312&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43312&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43312&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43312&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43312&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43312&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43312&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43312&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43312&r=support Expected behavior: http://bugs.php.net/fix.php?id=43312&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43312&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43312&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43312&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43312&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43312&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43312&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43312&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43312&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43312&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43312&r=mysqlcfg