Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17261 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88209 invoked by uid 1010); 14 Jul 2005 08:23:00 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 88194 invoked from network); 14 Jul 2005 08:23:00 -0000 Received: from unknown (HELO lerdorf.com) (127.0.0.1) by localhost with SMTP; 14 Jul 2005 08:23:00 -0000 X-Host-Fingerprint: 204.11.219.139 lerdorf.com Linux 2.4/2.6 Received: from ([204.11.219.139:40301] helo=colo.lerdorf.com) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id F9/BC-23681-3E026D24 for ; Thu, 14 Jul 2005 04:23:00 -0400 Received: from [192.168.2.106] (c-24-6-1-160.hsd1.ca.comcast.net [24.6.1.160]) (authenticated bits=0) by colo.lerdorf.com (8.13.4/8.13.4/Debian-3) with ESMTP id j6E8Mo86028112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 14 Jul 2005 01:22:51 -0700 Message-ID: <42D620D9.9010707@lerdorf.com> Date: Thu, 14 Jul 2005 01:22:49 -0700 User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rasmus Lerdorf CC: internals@lists.php.net, jorton@redhat.com References: <42D62017.9010103@lerdorf.com> In-Reply-To: <42D62017.9010103@lerdorf.com> X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/mixed; boundary="------------080700090000060901060807" Subject: Re: [PHP-DEV] Apache2 patch sanity check From: rasmus@lerdorf.com (Rasmus Lerdorf) --------------080700090000060901060807 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Rasmus Lerdorf wrote: > This patch ... Ah, crap, an unrelated sapi_get_request_time backport patch snuck in there. Here is the clean patch. --------------080700090000060901060807 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="a2.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="a2.txt" Index: sapi_apache2.c =================================================================== RCS file: /repository/php-src/sapi/apache2handler/sapi_apache2.c,v retrieving revision 1.1.2.40 diff -u -r1.1.2.40 sapi_apache2.c --- sapi_apache2.c 8 Apr 2005 20:35:02 -0000 1.1.2.40 +++ sapi_apache2.c 14 Jul 2005 08:08:58 -0000 @@ -454,6 +459,21 @@ TSRMLS_FETCH(); conf = ap_get_module_config(r->per_dir_config, &php4_module); + + /* apply_config() needs r in some cases, so allocate server_context early */ + ctx = SG(server_context); + if (ctx == NULL) { + ctx = SG(server_context) = apr_pcalloc(r->pool, sizeof(*ctx)); + /* register a cleanup so we clear out the SG(server_context) + * after each request. Note: We pass in the pointer to the + * server_context in case this is handled by a different thread. + */ + apr_pool_cleanup_register(r->pool, (void *)&SG(server_context), php_server_context_cleanup, apr_pool_cleanup_null); + ctx->r = r; + ctx = NULL; /* May look weird to null it here, but it is to catch the right case in the first_try later on */ + } else { + ctx->r = r; + } apply_config(conf); if (strcmp(r->handler, PHP_MAGIC_TYPE) && strcmp(r->handler, PHP_SOURCE_MAGIC_TYPE) && strcmp(r->handler, PHP_SCRIPT)) { @@ -511,17 +531,9 @@ zend_first_try { - ctx = SG(server_context); if (ctx == NULL) { - ctx = SG(server_context) = apr_pcalloc(r->pool, sizeof(*ctx)); - /* register a cleanup so we clear out the SG(server_context) - * after each request. Note: We pass in the pointer to the - * server_context in case this is handled by a different thread. - */ - apr_pool_cleanup_register(r->pool, (void *)&SG(server_context), php_server_context_cleanup, apr_pool_cleanup_null); - - ctx->r = r; brigade = apr_brigade_create(r->pool, r->connection->bucket_alloc); + ctx = SG(server_context); ctx->brigade = brigade; if (php_apache_request_ctor(r, ctx TSRMLS_CC)!=SUCCESS) { --------------080700090000060901060807--