bjori                                    Wed, 06 Jul 2011 20:38:58 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=313026

Log:
Fixed bug#55084 (Function registered by header_register_callback is
called only once per process). (Hannes)

also fixed an issue when header()s are sent from the callback function

Bug: https://bugs.php.net/55084 (Open) Function registered by 
header_register_callback is called only once per process
      
Changed paths:
    U   php/php-src/branches/PHP_5_4/NEWS
    U   php/php-src/branches/PHP_5_4/main/SAPI.c
    U   php/php-src/trunk/main/SAPI.c

Modified: php/php-src/branches/PHP_5_4/NEWS
===================================================================
--- php/php-src/branches/PHP_5_4/NEWS   2011-07-06 19:55:49 UTC (rev 313025)
+++ php/php-src/branches/PHP_5_4/NEWS   2011-07-06 20:38:58 UTC (rev 313026)
@@ -141,6 +141,8 @@
     separators to the first byte. FR #53457. (Adam)
   . Added hex2bin() function. (Scott)
   . Fixed crypt_blowfish handling of 8-bit characters. (Stas) (CVE-2011-2483)
+  . Fixed bug#55084 (Function registered by header_register_callback is
+    called only once per process). (Hannes)

 - Improved CURL extension:
   . Added support for CURLOPT_MAX_RECV_SPEED_LARGE and

Modified: php/php-src/branches/PHP_5_4/main/SAPI.c
===================================================================
--- php/php-src/branches/PHP_5_4/main/SAPI.c    2011-07-06 19:55:49 UTC (rev 
313025)
+++ php/php-src/branches/PHP_5_4/main/SAPI.c    2011-07-06 20:38:58 UTC (rev 
313026)
@@ -430,6 +430,8 @@
        SG(sapi_headers).http_status_line = NULL;
        SG(sapi_headers).mimetype = NULL;
        SG(headers_sent) = 0;
+       SG(callback_run) = 0;
+       SG(callback_func) = NULL;
        SG(read_post_bytes) = 0;
        SG(request_info).post_data = NULL;
        SG(request_info).raw_post_data = NULL;
@@ -539,6 +541,10 @@
        sapi_send_headers_free(TSRMLS_C);
        SG(sapi_started) = 0;
        SG(headers_sent) = 0;
+       SG(callback_run) = 0;
+       if (SG(callback_func)) {
+               zval_ptr_dtor(&SG(callback_func));
+       }
        SG(request_info).headers_read = 0;
        SG(global_request_time) = 0;
 }
@@ -816,7 +822,7 @@
        int retval;
        int ret = FAILURE;

-       if (SG(headers_sent) || SG(request_info).no_headers) {
+       if (SG(headers_sent) || SG(request_info).no_headers || 
SG(callback_run)) {
                return SUCCESS;
        }


Modified: php/php-src/trunk/main/SAPI.c
===================================================================
--- php/php-src/trunk/main/SAPI.c       2011-07-06 19:55:49 UTC (rev 313025)
+++ php/php-src/trunk/main/SAPI.c       2011-07-06 20:38:58 UTC (rev 313026)
@@ -430,6 +430,8 @@
        SG(sapi_headers).http_status_line = NULL;
        SG(sapi_headers).mimetype = NULL;
        SG(headers_sent) = 0;
+       SG(callback_run) = 0;
+       SG(callback_func) = NULL;
        SG(read_post_bytes) = 0;
        SG(request_info).post_data = NULL;
        SG(request_info).raw_post_data = NULL;
@@ -539,6 +541,10 @@
        sapi_send_headers_free(TSRMLS_C);
        SG(sapi_started) = 0;
        SG(headers_sent) = 0;
+       SG(callback_run) = 0;
+       if (SG(callback_func)) {
+               zval_ptr_dtor(&SG(callback_func));
+       }
        SG(request_info).headers_read = 0;
        SG(global_request_time) = 0;
 }
@@ -816,7 +822,7 @@
        int retval;
        int ret = FAILURE;

-       if (SG(headers_sent) || SG(request_info).no_headers) {
+       if (SG(headers_sent) || SG(request_info).no_headers || 
SG(callback_run)) {
                return SUCCESS;
        }


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to