rasmus          Mon Jul 25 18:38:11 2005 EDT

  Modified files:              
    /php-src    NEWS 
    /php-src/sapi/apache2handler        sapi_apache2.c 
  Log:
  MFB fix for bug #33690
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2006&r2=1.2007&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2006 php-src/NEWS:1.2007
--- php-src/NEWS:1.2006 Sat Jul 23 19:34:02 2005
+++ php-src/NEWS        Mon Jul 25 18:38:10 2005
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2005, PHP 5.1
+- Fixed bug #33690 (Crash setting some ini directives in httpd.conf). (Rasmus)
 - Fixed bug #33841 (pdo sqlite driver forgets to update affected column count
   on execution of prepared statments).
 - Fixed bug #33802 (throw Exception in error handler causes crash). (Dmitry)
http://cvs.php.net/diff.php/php-src/sapi/apache2handler/sapi_apache2.c?r1=1.55&r2=1.56&ty=u
Index: php-src/sapi/apache2handler/sapi_apache2.c
diff -u php-src/sapi/apache2handler/sapi_apache2.c:1.55 
php-src/sapi/apache2handler/sapi_apache2.c:1.56
--- php-src/sapi/apache2handler/sapi_apache2.c:1.55     Mon Jun 20 08:46:34 2005
+++ php-src/sapi/apache2handler/sapi_apache2.c  Mon Jul 25 18:38:11 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: sapi_apache2.c,v 1.55 2005/06/20 12:46:34 tony2001 Exp $ */
+/* $Id: sapi_apache2.c,v 1.56 2005/07/25 22:38:11 rasmus Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -454,6 +454,21 @@
        TSRMLS_FETCH();
 
        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) {
+               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 +526,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 CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to