ZEND_HANDLE_FD handling not fully implemented ?
| From: | Jerome Delamarche | Date: | Mon, 17 Jun 2002 13:03:23 +0000 |
| Subject: | ZEND_HANDLE_FD handling not fully implemented ? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-85271@lists.php.net to get a copy of this message | ||
Hello,
I'm writing an Apache module that must communicate with mod_php4 (see
below).
The data that must be parsed by the Zend scanner won't come from a filename
but from a file descriptor.
It seems that data source is described by a "zend_file_handle" object (in
sapi.sapi_apache.c). This structure has a type "field" wichi value can be
ZEND_HANDLE_FILENAME or ZEND_HANDLE_FD.
But in fact, I had to patch apache_php_module_main() function to make
mod_php4 handle correctly a ZEND_HANDLE_FD.
Is that a bug or a feature ? Will it be possible to expect ZEND_HANDLE_FD
work fine in a future version ?
Thanks,
Jerome
P.S: to explain how I want to call mod_php4, I get the address of the
request handler for content-type "application/x-httpd-php" and call it
paasing it the Apache request_rec * structure this way:
fd = open(.....);
sprintf(buff,"%d",fd);
r->filename = buf;
(*handler)(r);
close(fd);
and I have patched sapi/sapi_apache.c this way (it's ugly but it works):
if (atoi(r->filename) <= 0) {
/* standard way: */
file_handle.type = ZEND_HANDLE_FILENAME;
file_handle.handle.fd = 0;
file_handle.filename = SG(request_info).path_translated;
}
else {
/* hack: */
file_handle.type = ZEND_HANDLE_FD;
file_handle.handle.fd = atoi(r->filename);
file_handle.filename = r->filename;
}