From 5ddd67d90b70bd9f2f8445dafd0656909ccf06ed Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Wed, 6 Jul 2011 20:38:58 +0000 Subject: [PATCH] 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 --- NEWS | 2 ++ main/SAPI.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ef8f2481fb..3d8f1ef555 100644 --- a/NEWS +++ b/NEWS @@ -141,6 +141,8 @@ PHP NEWS 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 diff --git a/main/SAPI.c b/main/SAPI.c index a0d58805fb..91ed4be654 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -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; } -- 2.50.1