php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4153 crash when loading PHP4 DSO file
Submitted: 2000-04-15 17:38 UTC Modified: 2000-07-26 22:46 UTC
From: dolecek at ics dot muni dot cz Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0 Release Candidate 1 OS: NetBSD (1.4.1 userland, 1.4X ker
Private report: No CVE-ID: None
 [2000-04-15 17:38 UTC] dolecek at ics dot muni dot cz
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-26 22:46 UTC] rasmus@php.net
Fixed in CVS
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 22:00:01 2026 UTC