From 36be1040ebdfbcf5dc7f266fb542649dd145d19f Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Mon, 23 Jul 2001 01:03:22 +0000 Subject: [PATCH] Use synchronous php_request_shutdown in the standard case and let the pool cleanup function only become effective, when an error has occured. This fixes the problem that the request_conn was already dead when the request_shutdown was reached. --- sapi/apache/mod_php4.c | 6 ++++-- sapi/apache/sapi_apache.c | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c index 53ddb92d87..a58df34143 100644 --- a/sapi/apache/mod_php4.c +++ b/sapi/apache/mod_php4.c @@ -312,9 +312,11 @@ static void php_apache_request_shutdown(void *dummy) SLS_FETCH(); APLS_FETCH(); - AP(in_request)=0; SG(server_context) = NULL; /* The server context (request) is invalid by the time run_cleanups() is called */ - php_request_shutdown(dummy); + if (AP(in_request)) { + AP(in_request) = 0; + php_request_shutdown(dummy); + } } /* }}} */ diff --git a/sapi/apache/sapi_apache.c b/sapi/apache/sapi_apache.c index 5d5a7fbc96..35d707d024 100644 --- a/sapi/apache/sapi_apache.c +++ b/sapi/apache/sapi_apache.c @@ -56,13 +56,14 @@ #include "ext/standard/php_standard.h" #include "util_script.h" #include "php_version.h" -/*#include "mod_php4.h"*/ +#include "mod_php4.h" /* {{{ apache_php_module_main */ int apache_php_module_main(request_rec *r, int display_source_mode CLS_DC ELS_DC PLS_DC SLS_DC) { zend_file_handle file_handle; + APLS_FETCH(); if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) { return FAILURE; @@ -90,10 +91,12 @@ int apache_php_module_main(request_rec *r, int display_source_mode CLS_DC ELS_DC (void) php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC); } + AP(in_request) = 0; + zend_try { - php_end_ob_buffers(1); - php_header(); /* Make sure headers have been sent */ + php_request_shutdown(NULL); } zend_end_try(); + return (OK); } /* }}} */ -- 2.50.1