Re: Q: ZEND_HANDLE_STREAM and wincache extension on PHP 5.4

From: Date: Wed, 21 Mar 2012 06:46:31 +0000
Subject: Re: Q: ZEND_HANDLE_STREAM and wincache extension on PHP 5.4
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi Eric,

Sorry, I don't read @internals every day. Please CC me if you need quick answer.

Really I don't see the reason why wincache stores the PHP file source. Storing compiled opcodes must be enough. To avoid re-reading of already cached file. opcode cache should override zend_stream_open() and return stream of type ZEND_HANDLE_FILENAME.

Anyway, I don't see a way to fix PHP to support custom streams without BC break, because zend_streams doesn't provide handlers for seeking.

The best solution would be handling shebang lines by parser/scanner. It even was done few years ago, but than was reverted.

Thanks. Dmitry.


On 03/15/2012 10:56 PM, Eric Stenson wrote:
PHP Internals folks-- My name is Eric Stenson, and I'm a developer at Microsoft working on IIS. I've been given the task of upgrading our php_wincache extension to work on PHP5.4, and I've run into a problem. The problem I'm running into is the php_cgi!main() on PHP5.4 has changed behavior. The php_cgi!main() function is seeing us return a ZEND_HANDLE_STREAM, and it's assuming that the zend_file_handle.handle.stream.handle (void *) is a (php_stream*), when in fact it's php_wincache's (fcache_handle *). It then attempts to access the php_stream.ops (a v-table-ish struct), which is not in the fcache_handle, and it jumps off into an invalid address and promptly AV's. I'm trying to understand why our php_wincache!fcache_useval() thinks it's okay to set zend_file_handle.handle.stream.handle to (fcache_handle *). I'm having trouble understanding what the responsibilities are of a PHP extension that extends the file system as php_wincache does. Could you point me at any developer documents for PHP extension developers that explains what php_wincache *should* be doing? I'm very much a novice at PHP code, or writing a PHP extension, so I feel like I'm flailing around without understanding what PHP extensions are supposed to do. Any pointers, guidance, and architecture advice would be massively helpful! Thank you!
           --E.


Thread (8 messages)

« previous php.internals (#59109) next »