summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorreeze <reeze.xia@gmail.com>2012-03-29 00:18:02 +0800
committerreeze <reeze.xia@gmail.com>2012-03-29 00:18:02 +0800
commit9bc91a21db733b5e12ab6a4356b2470b72d784d5 (patch)
treed4b2f1d4f0b5f1fb0cb1a1d116f1f8958734d1c1
parent4fa0c2a96331d9d43c08575fd6ea9957cf0671b6 (diff)
downloadphp-git-9bc91a21db733b5e12ab6a4356b2470b72d784d5.tar.gz
- fix bug #61541, Segfault when using ob_* in output_callback
-rw-r--r--main/output.c11
-rw-r--r--tests/output/ob_011.phpt2
2 files changed, 11 insertions, 2 deletions
diff --git a/main/output.c b/main/output.c
index fb589a2a3b..5a7ed7b1a2 100644
--- a/main/output.c
+++ b/main/output.c
@@ -225,6 +225,17 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS
zval *orig_buffer;
zval *z_status;
+ if(OG(ob_lock)) {
+ if (SG(headers_sent) && !SG(request_info).headers_only) {
+ OG(php_body_write) = php_ub_body_write_no_header;
+ } else {
+ OG(php_body_write) = php_ub_body_write;
+ }
+ OG(ob_nesting_level) = 0;
+ php_error_docref("ref.outcontrol" TSRMLS_CC, E_ERROR, "Cannot use output buffering in output buffering display handlers");
+ return;
+ }
+
ALLOC_INIT_ZVAL(orig_buffer);
ZVAL_STRINGL(orig_buffer, OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, 1);
diff --git a/tests/output/ob_011.phpt b/tests/output/ob_011.phpt
index a90fd56f83..35b0388339 100644
--- a/tests/output/ob_011.phpt
+++ b/tests/output/ob_011.phpt
@@ -1,7 +1,5 @@
--TEST--
output buffering - fatalism
---XFAIL--
-This test will fail until the fix in revision r214155 is backported from php 6
--FILE--
<?php
function obh($s)