|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-07-26 09:21 UTC] tendencies at free dot fr
[2006-09-08 21:04 UTC] tony2001@php.net
[2006-09-16 01:00 UTC] php-bugs at lists dot php dot net
[2010-06-13 14:51 UTC] felipe@php.net
-Status: No Feedback
+Status: Open
[2011-08-30 11:46 UTC] bjori@php.net
-Status: Open
+Status: Bogus
[2011-08-30 11:46 UTC] bjori@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 23:00:01 2025 UTC |
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.