From: bugs at php dot frankkleine dot de Operating system: irrelevant PHP version: 5.2.1 PHP Bug Type: Feature/Change Request Bug description: DOMDocument::load() does not support stream wrappers
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 -- Edit bug report at http://bugs.php.net/?id=40656&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40656&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40656&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40656&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40656&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40656&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40656&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40656&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40656&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40656&r=support Expected behavior: http://bugs.php.net/fix.php?id=40656&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40656&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40656&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40656&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40656&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40656&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40656&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40656&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40656&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40656&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40656&r=mysqlcfg