Rasmus Lerdorf wrote: > This patch ... Ah, crap, an unrelated sapi_get_request_time backport patch snuck in there. Here is the clean patch.
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) {
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php