From: Aaron Bannert Date: Thu, 18 Apr 2002 16:34:49 +0000 (+0000) Subject: Fix an intermittent SEGV when an error bubbled up from PHP before our X-Git-Tag: php-4.2.0~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=34b94f143ea06b1587ffdae2f579450af8f5507b;p=php Fix an intermittent SEGV when an error bubbled up from PHP before our server context was set. Now if that happens we simply don't log against any particular server config (vhost). Obtained from bug report by: Balazs Nagy --- diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index 856d146c34..11a2632e2f 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -211,7 +211,14 @@ static void php_apache_sapi_log_message(char *msg) * line. Not sure if this is correct, but it mirrors what happens * with Apache 1.3 -- rbb */ - ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO | APLOG_STARTUP, 0, ctx->r->server, "%s", msg); + if (ctx == NULL) { /* we haven't initialized our ctx yet, oh well */ + ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO | APLOG_STARTUP, + 0, NULL, "%s", msg); + } + else { + ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO | APLOG_STARTUP, + 0, ctx->r->server, "%s", msg); + } } static sapi_module_struct apache2_sapi_module = {