com php-src: - fix bug #61541, Segfault when using ob_* in output_callback: main/output.c tests/output/ob_ 011.phpt
| From: | Yasuo Ohgaki | Date: | Wed, 28 Mar 2012 16:18:02 +0000 |
| Subject: | com php-src: - fix bug #61541, Segfault when using ob_* in output_callback: main/output.c tests/output/ob_ 011.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-68232@lists.php.net to get a copy of this message | ||
Commit: 9bc91a21db733b5e12ab6a4356b2470b72d784d5
Author: reeze <reeze.xia@gmail.com> Thu, 29 Mar 2012 00:18:02 +0800
Parents: 4fa0c2a96331d9d43c08575fd6ea9957cf0671b6
Branches: PHP-5.3
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9bc91a21db733b5e12ab6a4356b2470b72d784d5
Log:
- fix bug #61541, Segfault when using ob_* in output_callback
Bugs:
https://bugs.php.net/61541
Changed paths:
M main/output.c
M tests/output/ob_011.phpt
Diff:
9bc91a21db733b5e12ab6a4356b2470b72d784d5
diff --git a/main/output.c b/main/output.c
index fb589a2..5a7ed7b 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 a90fd56..35b0388 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)