PHP 4.0 Bug #4153: crash when loading PHP4 DSO file
| From: | dolecek at ics dot muni dot cz | Date: | Sat, 15 Apr 2000 21:38:24 +0000 |
| Subject: | PHP 4.0 Bug #4153: crash when loading PHP4 DSO file | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-17935@lists.php.net to get a copy of this message | ||
From: dolecek@ics.muni.cz
Operating system: NetBSD (1.4.1 userland, 1.4X kernel)
PHP version: 4.0 Release Candidate 1
PHP Bug Type: Reproduceable crash
Bug description: crash when loading PHP4 DSO file
Theres seems to be a bug in egcs-1.1.1, which is triggered
by extern definition of sapi_module.
Each sapi module (e.g. Apache, CGI etc) defines
it's own static sapi_module. &sapi_module is then
passed to sapi_startup() and other functions.
Seems like there exists a global sapi_module
somewhere and since SAPI.h provides extern
definition for it, egcs picks the global one
instead of the local one. This leads to crash
as soon as some member of sapi_module is actually
used.
Following patch fixes the problem for Apache module,
something similar should be done for other SAPI
modules:
--- mod_php4.c.orig Sat Apr 15 23:01:07 2000
+++ mod_php4.c Sat Apr 15 23:14:19 2000
@@ -73,6 +73,8 @@
int php_xbithack_handler(request_rec * r);
static void php_init_handler(server_rec *s, pool *p);
+static sapi_module_struct php_apache_sapi_module;
+
#if MODULE_MAGIC_NUMBER > 19961007
#define CONST_PREFIX const
#else
@@ -317,7 +319,7 @@
}
-static sapi_module_struct sapi_module = {
+static sapi_module_struct php_apache_sapi_module = {
"Apache", /* name */
php_apache_startup, /* startup */
@@ -562,8 +564,8 @@
php_per_dir_entry per_dir_entry;
if (!apache_php_initialized) {
- sapi_startup(&sapi_module);
- php_apache_startup(&sapi_module);
+ sapi_startup(&php_apache_sapi_module);
+ php_apache_startup(&php_apache_sapi_module);
apache_php_initialized = 1;
}
per_dir_entry.type = mode;
@@ -648,7 +650,7 @@
static void apache_php_module_shutdown_wrapper(void)
{
apache_php_initialized = 0;
- sapi_module.shutdown(&sapi_module);
+ php_apache_sapi_module.shutdown(&php_apache_sapi_module);
}
@@ -656,8 +658,8 @@
{
register_cleanup(p, NULL, (void (*)(void *))apache_php_module_shutdown_wrapper, (void (*)(void
*))php_module_shutdown_for_exec);
if (!apache_php_initialized) {
- sapi_startup(&sapi_module);
- php_apache_startup(&sapi_module);
+ sapi_startup(&php_apache_sapi_module);
+ php_apache_startup(&php_apache_sapi_module);
apache_php_initialized = 1;
}
#if MODULE_MAGIC_NUMBER >= 19980527