Re: Q: ZEND_HANDLE_STREAM and wincache extension on PHP 5.4

From: Date: Thu, 15 Mar 2012 22:02:26 +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
On Thu, 15 Mar 2012 19:56:11 +0100, Eric Stenson <[email protected]> wrote:

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 think you should contact Dmitry, as he was the one that committed r301058. That code looks very strange. It seems to want to break the abstraction of zend_stream and assume that handle stores a php_stream (to use e.g. zend_stream_getc instead of php_stream_getc). But I don't think the assumption done to break the abstraction is correct. For instance, see http://lxr.php.net/opengrok/xref/PHP_TRUNK/ext/phar/phar.c#3364 which has: file_handle->handle.stream.handle = phar; and *phar is of type phar_archive_data, which is not a php_stream (or an augmentation thereof). -- Gustavo Lopes

Thread (8 messages)

« previous php.internals (#58973) next »