rasmus Mon Oct 17 15:35:45 2005 EDT
Modified files: (Branch: PHP_5_0)
/php-src/sapi/apache2handler sapi_apache2.c
Log:
MFH the fix to bug #33690
http://cvs.php.net/diff.php/php-src/sapi/apache2handler/sapi_apache2.c?r1=1.40.2.12&r2=1.40.2.13&ty=u
Index: php-src/sapi/apache2handler/sapi_apache2.c
diff -u php-src/sapi/apache2handler/sapi_apache2.c:1.40.2.12
php-src/sapi/apache2handler/sapi_apache2.c:1.40.2.13
--- php-src/sapi/apache2handler/sapi_apache2.c:1.40.2.12 Tue Oct 4
20:44:04 2005
+++ php-src/sapi/apache2handler/sapi_apache2.c Mon Oct 17 15:35:39 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sapi_apache2.c,v 1.40.2.12 2005/10/05 00:44:04 iliaa Exp $ */
+/* $Id: sapi_apache2.c,v 1.40.2.13 2005/10/17 19:35:39 rasmus Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -452,6 +452,23 @@
} \
conf = ap_get_module_config(r->per_dir_config, &php5_module);
+
+ /* apply_config() needs r in some cases, so allocate server_context
early */
+ ctx = SG(server_context);
+ if (ctx == NULL) {
+normal:
+ 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 {
+ parent_req = ctx->r;
+ 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)) {
@@ -499,25 +516,24 @@
zend_first_try {
- ctx = SG(server_context);
if (ctx == NULL) {
-normal:
- 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) {
zend_bailout();
}
} else {
- parent_req = ctx->r;
+ if (!parent_req) {
+ parent_req = ctx->r;
+ }
+ if (parent_req && strcmp(parent_req->handler, PHP_MAGIC_TYPE)
&& strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE) &&
strcmp(parent_req->handler, PHP_SCRIPT)) {
+ if (php_apache_request_ctor(r, ctx TSRMLS_CC)!=SUCCESS)
{
+ zend_bailout();
+ }
+ }
+
/* check if comming due to ErrorDocument */
if (parent_req && parent_req->status != HTTP_OK) {
parent_req = NULL;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php