]> granicus.if.org Git - php/commitdiff
- fix bug #61541, Segfault when using ob_* in output_callback
authorreeze <reeze.xia@gmail.com>
Wed, 28 Mar 2012 16:18:02 +0000 (00:18 +0800)
committerreeze <reeze.xia@gmail.com>
Wed, 28 Mar 2012 16:18:02 +0000 (00:18 +0800)
main/output.c
tests/output/ob_011.phpt

index fb589a2a3b41e73eaa526c9323bc3d14033986bf..5a7ed7b1a2338d5d585471881b43284e27b15424 100644 (file)
@@ -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);
 
index a90fd56f8396c56c83ebb6d55e0cf74dc878f8b0..35b038833907fba53c87d40a5d7193db73a1262c 100644 (file)
@@ -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)