Q: ZEND_HANDLE_STREAM and wincache extension on PHP 5.4

From: Date: Thu, 15 Mar 2012 18:56:11 +0000
Subject: Q: ZEND_HANDLE_STREAM and wincache extension on PHP 5.4
Groups: php.internals 
Request: Send a blank email to internals+get-58968@lists.php.net to get a copy of this message
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.

« previous php.internals (#58968) next »