From: [EMAIL PROTECTED] Operating system: any PHP version: 5CVS-2006-04-16 (CVS) PHP Bug Type: Streams related Bug description: referencing bug with return value for stream_seek
Description: ------------ When using user-space streams via stream_wrapper_register(), if you return the value of a property of the object from stream_seek(), it gets mangled. Sounds like a problem with the way that the retval from call_user_function_ex() is disposed. The workaround is to create a temporary value using a trick like this: function stream_seek($offset, $whence) { ... $retval = $this->pos + 0; return $retval; } presumably the rest of the user wrapper code has the same flaw. Reproduce code: --------------- Abbreviated example; my actual test case is too large. Valgrind does not indicate any memory errors, so the problem is likely logical rather than sloppy memory handling. class MyStream { var $this->pos = 0; function stream_tell() { return $this->pos; } function stream_seek($offset, $whence) { return $this->pos; } } Actual result: -------------- Problem manifested for me by converting $this->pos to bool(true), which was then interpreted by the user space wrapper as an invalid return value from stream_tell(), which simply returns $this->pos. -- Edit bug report at http://bugs.php.net/?id=37096&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37096&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37096&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37096&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37096&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37096&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37096&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37096&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37096&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37096&r=support Expected behavior: http://bugs.php.net/fix.php?id=37096&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37096&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37096&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37096&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37096&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37096&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37096&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37096&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37096&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37096&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37096&r=mysqlcfg