Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- fix bug #61541, Segfault when using ob_* in output_callback

  • Loading branch information...
commit abd2b2ee4332e598f46efec0cac0a9f546bc4f2d 1 parent 5ddfdb8
@reeze reeze authored yohgaki committed
Showing with 11 additions and 2 deletions.
  1. +11 −0 main/output.c
  2. +0 −2  tests/output/ob_011.phpt
View
11 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);
View
2  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)
Please sign in to comment.
Something went wrong with that request. Please try again.