|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-01-06 11:29 UTC] bart at mediawave dot nl
[2004-01-07 10:31 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 16:00:01 2025 UTC |
Description: ------------ I used the Xinclude PHP5 example from Bitflux. Then when I tried to iterate through the resulting DOM object I got an access violation. Reproduce code: --------------- <? class VariableStream { var $position; var $varname; function stream_open($path, $mode, $options, &$opened_path) { $url = parse_url($path); $this->varname = $url["host"]; $this->position = 0; return true; } function stream_read($count) { $ret = substr($GLOBALS[$this->varname], $this->position, $count); $this->position += strlen($ret); return $ret; } function stream_eof() { return $this->position >= strlen($GLOBALS[$this->varname]); } function url_stat() { return array(); } } $xmlstring = '<?xml version="1.0"?> <foo xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="var://bar#xpointer(/foo/bar)"/> </foo>'; stream_wrapper_register("var", "VariableStream"); $bar = '<foo><bar>hello world</bar></foo>'; $dom = new domdocument; $dom->loadXML($xmlstring); $dom->xinclude(); print nl2br(htmlspecialchars($dom->saveXML())); foreach ($dom->documentElement->childNodes AS $node) { echo '<br>'; echo $node->nodeName; echo ' - '; echo $node->nodeValue; } ?> Expected result: ---------------- <?xml version="1.0"?> <foo xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="var://bar#xpointer(/foo/bar)"/> </foo> #text - bar - hello world #text - Actual result: -------------- <?xml version="1.0"?> <foo xmlns:xi="http://www.w3.org/2001/XInclude"> <bar xml:base="var://bar">hello world</bar> </foo> #text - Warning: main() [function.main]: Unsupported node type: 19 in E:\projects\projects\^General\Wrapper\wrap_v5\domtest.php on line 44 - PHP has encountered an Access Violation at 018BC3B2