Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions main/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions tests/output/ob_011.phpt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down