]> granicus.if.org Git - php/commitdiff
Fix an intermittent SEGV when an error bubbled up from PHP before our
authorAaron Bannert <aaron@php.net>
Thu, 18 Apr 2002 16:34:06 +0000 (16:34 +0000)
committerAaron Bannert <aaron@php.net>
Thu, 18 Apr 2002 16:34:06 +0000 (16:34 +0000)
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 <js@iksz.hu>

sapi/apache2filter/sapi_apache2.c

index e84fd3ede41c982e616004c21b027e8bf7733452..decc641570e7b91cce6243d67bb50867df2ff7df 100644 (file)
@@ -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 = {