Skip to content

Commit f35b85b

Browse files
committed
Fix bug php#11678
1 parent 8133703 commit f35b85b

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

ext/standard/output.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,16 @@ PHP_FUNCTION(ob_start)
540540
break;
541541
}
542542
if (php_start_ob_buffer(output_handler, chunk_size)==FAILURE) {
543-
php_error(E_WARNING, "Cannot use output buffering in output buffering display handlers");
543+
SLS_FETCH();
544+
OLS_FETCH();
545+
546+
if (SG(headers_sent) && !SG(request_info).headers_only) {
547+
OG(php_body_write) = php_ub_body_write_no_header;
548+
} else {
549+
OG(php_body_write) = php_ub_body_write;
550+
}
551+
OG(nesting_level) = 0;
552+
php_error(E_ERROR, "Cannot use output buffering in output buffering display handlers");
544553
RETURN_FALSE;
545554
}
546555
RETURN_TRUE;

main/output.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,16 @@ PHP_FUNCTION(ob_start)
540540
break;
541541
}
542542
if (php_start_ob_buffer(output_handler, chunk_size)==FAILURE) {
543-
php_error(E_WARNING, "Cannot use output buffering in output buffering display handlers");
543+
SLS_FETCH();
544+
OLS_FETCH();
545+
546+
if (SG(headers_sent) && !SG(request_info).headers_only) {
547+
OG(php_body_write) = php_ub_body_write_no_header;
548+
} else {
549+
OG(php_body_write) = php_ub_body_write;
550+
}
551+
OG(nesting_level) = 0;
552+
php_error(E_ERROR, "Cannot use output buffering in output buffering display handlers");
544553
RETURN_FALSE;
545554
}
546555
RETURN_TRUE;

0 commit comments

Comments
 (0)