summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/SAPI.h1
-rw-r--r--sapi/apache2/mod_php4.c14
2 files changed, 12 insertions, 3 deletions
diff --git a/main/SAPI.h b/main/SAPI.h
index c8e8562ed9..918912b717 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -102,7 +102,6 @@ typedef struct {
char *default_charset;
HashTable *rfc1867_uploaded_files;
long post_max_size;
- void *server_filter;
} sapi_globals_struct;
diff --git a/sapi/apache2/mod_php4.c b/sapi/apache2/mod_php4.c
index b92c50980b..0ab579764e 100644
--- a/sapi/apache2/mod_php4.c
+++ b/sapi/apache2/mod_php4.c
@@ -91,6 +91,15 @@ module MODULE_VAR_EXPORT php4_module;
int saved_umask;
static unsigned char apache_php_initialized;
+/* per-thread globals (when the ZTS stuff gets added) */
+typedef struct {
+ ap_filter_t *server_filter;
+} php_ap_globals_struct;
+
+/* Needs to be per-thread when in threaded mode (per-server for now in pre-fork
+ * mode) */
+static php_ap_globals_struct *php_ap_globals;
+
typedef struct _php_per_dir_entry {
char *key;
char *value;
@@ -122,7 +131,7 @@ static int sapi_apache_ub_write(const char *str, uint str_length)
bb = ap_brigade_create(r->pool);
b = ap_bucket_create_immortal(str, str_length);
AP_BRIGADE_INSERT_TAIL(bb, b);
- ap_pass_brigade(SG(server_filter)->next, bb);
+ ap_pass_brigade((php_ap_globals->server_filter)->next, bb);
} else {
ret = fwrite(str, 1, str_length, stderr);
}
@@ -714,7 +723,8 @@ static int php_filter(ap_filter_t *f, ap_bucket_brigade *bb) {
if (ctx == NULL) {
f->ctx = ctx = apr_pcalloc(c->pool, sizeof(php_output_filter_ctx_t));
ctx->b = ap_brigade_create(c->pool); /* create an initial empty brigade */
- SG(server_filter) = f;
+ php_ap_globals = palloc(sizeof *php_ap_globals);
+ php_ap_globals->server_filter = f;
}
ap_save_brigade(f, ctx->bb, bb);