|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-02-27 11:22 UTC] rrichards@php.net
[2007-02-28 14:23 UTC] bugs at php dot frankkleine dot de
[2007-02-28 14:49 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Jan 01 07:00:01 2026 UTC |
Description: ------------ The DOMDocument::load() method does not support working with stream wrappers. It's an inconsistency within PHP, one would expect that this method works with stream wrappers as well just as other methods and functions do. Reproduce code: --------------- class MyStreamWrapper { protected $read = false; protected $stream = '<?xml version="1.0" encoding="iso-8859-1"?><foo><bar id="1">hello world</bar></foo>'; public function stream_open($path, $mode, $options, $opened_path) {return true; } public function stream_close() { } public function stream_read($count) { if (true == $this->read) { return ''; } $this->read = true; return $this->stream; } public function stream_eof() { return $this->read; } public function stream_stat() { return strlen($this->stream); } public function url_stat($path) { return strlen($this->stream); } } stream_wrapper_register('myStream', 'MyStreamWrapper'); $doc = DOMDocument::load('myStream://foo.xml'); var_dump($doc); Expected result: ---------------- object(DOMDocument)#1 (0) { } Actual result: -------------- Warning: DOMDocument::load() [function.DOMDocument-load]: I/O warning : failed to load external entity "myStream://foo" in DomDocument_load-StreamWrapper.php on line 43