From: Jani Taskinen Date: Fri, 11 Dec 2009 15:42:16 +0000 (+0000) Subject: MF53:- Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit) #Ilia.. X-Git-Tag: php-5.4.0alpha1~191^2~2239 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=304a6dd9f6f621c6418987ca37b0c6268386bd70;p=php MF53:- Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit) #Ilia.. --- diff --git a/main/main.c b/main/main.c index 3bf288bdd3..c259db0332 100644 --- a/main/main.c +++ b/main/main.c @@ -1667,7 +1667,15 @@ void php_request_shutdown(void *dummy) /* 3. Flush all output buffers */ zend_try { - if (SG(request_info).headers_only) { + zend_bool send_buffer = SG(request_info).headers_only ? 0 : 1; + + if (CG(unclean_shutdown) && PG(last_error_type) == E_ERROR && + PG(memory_limit) < zend_memory_usage(1 TSRMLS_CC) + ) { + send_buffer = 0; + } + + if (!send_buffer) { php_output_discard_all(TSRMLS_C); } else { php_output_end_all(TSRMLS_C);