Re: streams problem in 5.3

From: Date: Fri, 04 Mar 2011 18:12:22 +0000
Subject: Re: streams problem in 5.3
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-51569@lists.php.net to get a copy of this message
Hmm, it has already supported through ZEND_HANDLE_STREAM. So then, changing the interface of fopen_function to return zend_stream instead of FILE* should be fine. Moriyoshi On 2011/03/05, at 3:05, Moriyoshi Koizumi wrote: > 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 >> >

« previous php.internals (#51569) next »