summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2008-09-17 00:20:30 +0000
committerIlia Alshanetsky <iliaa@php.net>2008-09-17 00:20:30 +0000
commitfcc0fdd125fdb9e1713f91d027fe07d680a0cf36 (patch)
treec24fa0b392e6a7bb3dcd9c6b9d78f393421a8d93
parent2c98da2d17d68bde85ec8d5ddace336bb8d169be (diff)
downloadphp-git-fcc0fdd125fdb9e1713f91d027fe07d680a0cf36.tar.gz
Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit).
-rw-r--r--NEWS1
-rw-r--r--main/main.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 7f685aee20..2c43d5978a 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ PHP NEWS
- Fixed bug #45928 (large scripts from stdin are stripped at 16K border).
(Christian Schneider, Arnaud)
- Fixed bug #45911 (Cannot disable ext/hash). (Arnaud)
+- Fixed bug #45392 (ob_start()/ob_end_clean() and memory_limit). (Ilia)
- Fixed bug #45382 (timeout bug in stream_socket_enable_crypto).
(vnegrier at optilian dot com, Ilia
diff --git a/main/main.c b/main/main.c
index 241cedb799..1c9394c475 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1478,7 +1478,12 @@ void php_request_shutdown(void *dummy)
/* 3. Flush all output buffers */
zend_try {
- php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1) TSRMLS_CC);
+ zend_bool send_buffer = SG(request_info).headers_only ? 0 : 1;
+ if (CG(unclean_shutdown) && PG(last_error_type) == E_ERROR &&
+ !OG(active_ob_buffer).chunk_size && PG(memory_limit) < zend_memory_usage(1 TSRMLS_CC)) {
+ send_buffer = 0;
+ }
+ php_end_ob_buffers(send_buffer TSRMLS_CC);
} zend_end_try();
/* 4. Send the set HTTP headers (note: This must be done AFTER php_end_ob_buffers() !!) */