It looks like the only solution is define a new stream type for zend_stream that delegates stream operations to user-defined callbacks.
Moriyoshi On 2011/03/04, at 10:26, Stas Malyshev wrote: > Hi! > > I try to do some complex code with custom streams and I have discovered the > following problem: > > The code in main/streams/cast.c, specifically _php_stream_cast, creates > fopencookie() synthetic stream for streams that are not actual file streams. > Which works fine until such stream is used in include(), in which case it > ultimately arrives at zend_stream_fixup(). Which would in turn call > zend_stream_fsize() - which would do fstat(fileno(file_handle->handle.fp), > &buf) - and that would fail since you can't get fileno for FILE* created by > fopencookie. > Which ultimately means I can't use my custom streams for include(), which is > bad. Now, looking at the code, it doesn't actually need the exact size - http > streams can be included just fine - but insists on having it if it has fp > (which it can have for basically any kind of stream due to the cookie trick). > Does anyone has any idea why and if it can be fixed? > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php