]> granicus.if.org Git - php/commitdiff
Fixed bug#55084 (Function registered by header_register_callback is
authorHannes Magnusson <bjori@php.net>
Wed, 6 Jul 2011 20:38:58 +0000 (20:38 +0000)
committerHannes Magnusson <bjori@php.net>
Wed, 6 Jul 2011 20:38:58 +0000 (20:38 +0000)
called only once per process). (Hannes)

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

main/SAPI.c

index a0d58805fbcd34fe481e35c72837bc9af73f88d6..91ed4be65411126e0eb694c83e52d2adcb271534 100644 (file)
@@ -430,6 +430,8 @@ SAPI_API void sapi_activate(TSRMLS_D)
        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_API void sapi_deactivate(TSRMLS_D)
        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 @@ SAPI_API int sapi_send_headers(TSRMLS_D)
        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;
        }