RE: [PHP-DEV] php_module_startup: more than one additional_module impossible?
| From: | saguyer at gte dot net | Date: | Mon, 13 Sep 2004 04:03:52 +0000 |
| Subject: | RE: [PHP-DEV] php_module_startup: more than one additional_module impossible? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-12750@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Norbert Wagner [mailto:nw@softwarekombinat.de]
>
> Perhaps the sequence in php_module_startup() is essential here, I don't
> know...
You must have ZTS defined, yes? I've had the same problem. It has
something to do with the zend_post_startup() call in php_module_startup().
This also precludes a manual call to php_startup_extensions() from
working. :-(
> A solution might be to add a new php_module_startup_ex(...) function
> with the right parametes, and let php_module_startup() be a wrapper
> around it.
> At least this would keep existing SAPI-modules working:
>
>
> /* {{{ php_module_startup
> */
> int php_module_startup(sapi_module_struct *sf, zend_module_entry
> *additional_modules, uint num_additional_modules)
> {
> return php_module_startup_ex(
> sf, &additional_modules, num_additional_modules );
> }
>
>
> /* {{{ php_module_startup_ex
> */
> int php_module_startup_ex(sapi_module_struct *sf, zend_module_entry
> **additional_modules, uint num_additional_modules)
> {
> /* old php_module_startup() body here */
> }
>
> What do you think?
My opinion...your solution clearly achieves your desired goal.
However, I don't like the idea of leaving php_module_startup with
a broken interface. Since only one module would work, the
num_additional_modules param is misleading. I'd rather fix
the bug and have folks patch their code to the new face
(there ain't that many callers, and it's a trivial fix).
Course, I have no authority in the matter ;-)
Additionally, it is strange to me that we can't call
php_startup_extensions() at app init time after having called
php_module_startup(). But I don't understand the engine design
enough to know if that is prudent.
NOTE: I think it is also possible that if you add your custom
extension to the php/ext directory that the build scripts will
automatically pickup your extension and add its zend_module_entry
to the generated main/internal_functions.c file. Checkout
http://www.zend.com/apidoc/zend.build.php
for more info.
Cheers,
-Scott