#40656 [Bgs-Opn]: DOMDocument::load() urlencodes parts of an URI
ID: 40656 User updated by: bugs at php dot frankkleine dot de -Summary: DOMDocument::load() does not support stream wrappers Reported By: bugs at php dot frankkleine dot de -Status: Bogus +Status: Open -Bug Type: Feature/Change Request +Bug Type: DOM XML related Operating System: irrelevant PHP Version: 5.2.1 New Comment: Thanks to your reply I found out what the real problem is. The DOMDocument::load() urlencodes parts of the URI used for the stream wrapper: myStream://C:\master\bla.php?foo.xml becomes myStream://C:%5Cmaster%5Cbla.php?foo.xml To work properly, the stream wrapper class first has to look if the $path argument of stream_open() does exist, if not it has to do an urldecode() on the $path and then check if the urldecoded $path exists. It is my expectation that the stream wrapper should get the correct $path from DOMDocument::load(), not an urlencoded one. Previous Comments: [2007-02-27 11:22:35] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php url_stat needs to return an array [2007-02-27 10:05:52] bugs at php dot frankkleine dot de 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?foobar id=1hello 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 this bug report at http://bugs.php.net/?id=40656edit=1
#40656 [NEW]: DOMDocument::load() does not support stream wrappers
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?foobar id=1hello 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=40656edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40656r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40656r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40656r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40656r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40656r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40656r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=40656r=needscript Try newer version:http://bugs.php.net/fix.php?id=40656r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40656r=support Expected behavior:http://bugs.php.net/fix.php?id=40656r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40656r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40656r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40656r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40656r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40656r=dst IIS Stability:http://bugs.php.net/fix.php?id=40656r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40656r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40656r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40656r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=40656r=mysqlcfg
#39884 [NEW]: ReflectionParameter::getClass() throws exception for type hint self
From: bugs at php dot frankkleine dot de Operating system: PHP version: 5.2.0 PHP Bug Type: Unknown/Other Function Bug description: ReflectionParameter::getClass() throws exception for type hint self Description: The ReflectionParameter::getClass() method does not work properly if the reflected parameter uses self as type hint. Instead, a ReflectionException is thrown saying that the class self does not exist. Tested with 5.2 and 6.0.0-dev from Nov 22. Reproduce code: --- ?php class stubParamTest { function paramTest(self $param) { // nothing to do } } $test1 = new stubParamTest(); $test2 = new stubParamTest(); $test1-paramTest($test2); $refParam = new ReflectionParameter(array('stubParamTest', 'paramTest'), 'param'); var_dump($refParam-getClass()); ? Expected result: object(ReflectionClass)[4] public 'name' = 'stubParamTest' (length=13) Actual result: -- Fatal error: Uncaught exception 'ReflectionException' with message 'Class self does not exist' in C:\apachefriends\xampp1.5.3a\xampp\htdocs\tests\type_hint_self.php:13 Stack trace: #0 C:\apachefriends\xampp1.5.3a\xampp\htdocs\tests\type_hint_self.php(13): ReflectionParameter-getClass() #1 {main} thrown in C:\apachefriends\xampp1.5.3a\xampp\htdocs\tests\type_hint_self.php on line 13 -- Edit bug report at http://bugs.php.net/?id=39884edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39884r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39884r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39884r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39884r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39884r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39884r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=39884r=needscript Try newer version:http://bugs.php.net/fix.php?id=39884r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39884r=support Expected behavior:http://bugs.php.net/fix.php?id=39884r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39884r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39884r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39884r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39884r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39884r=dst IIS Stability:http://bugs.php.net/fix.php?id=39884r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39884r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39884r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39884r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=39884r=mysqlcfg