From: Arnaud Le Blanc Date: Mon, 18 Aug 2008 04:07:54 +0000 (+0000) Subject: Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit). X-Git-Tag: BEFORE_HEAD_NS_CHANGE~672 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9881ae9834ceb7f9a1391f3714b0de213774c7ab;p=php Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit). --- diff --git a/main/output.c b/main/output.c index 5a2b8641d3..89987f57a6 100644 --- a/main/output.c +++ b/main/output.c @@ -1275,7 +1275,11 @@ static inline int php_output_stack_pop(int flags TSRMLS_DC) /* pass output along */ if (context.out.data && context.out.used && !(flags & PHP_OUTPUT_POP_DISCARD)) { - php_output_write(context.out.data, context.out.used TSRMLS_CC); + /* in case of unclean_shutdown, do not output the buffer if it is not + * meant to be until end of script or ob_end_*() call */ + if (!CG(unclean_shutdown) || orphan->size) { + php_output_write(context.out.data, context.out.used TSRMLS_CC); + } } /* destroy the handler (after write!) */ diff --git a/tests/lang/bug45392.phpt b/tests/lang/bug45392.phpt new file mode 100644 index 0000000000..0962a9fe80 --- /dev/null +++ b/tests/lang/bug45392.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #45392 (ob_start()/ob_end_clean() and memory_limit) +--INI-- +display_errors=stderr +--FILE-- + +--EXPECTF-- +2 +Fatal error: Allowed memory size of %d bytes exhausted%s +5