Skip to content

Commit cec628b

Browse files
committed
Add notices which warn against attempting to start output buffering inside action/filter callbacks
1 parent 212454b commit cec628b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/wp-includes/template.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,10 @@ function wp_finalize_template_enhancement_output_buffer( string $output, int $ph
975975
* (either `WP_HTML_Tag_Processor` or `WP_HTML_Processor`), or else use {@see DOM\HtmlDocument} as of PHP 8.4 which
976976
* fully supports HTML5.
977977
*
978+
* Important: Because this filter is applied inside an output buffer callback (i.e. display handler), any callbacks
979+
* added to the filter must not attempt to start their own output buffers. Otherwise, PHP will raise a fatal error:
980+
* "Cannot use output buffering in output buffering display handlers."
981+
*
978982
* @since 6.9.0
979983
*
980984
* @param string $filtered_output HTML template enhancement output buffer.
@@ -996,6 +1000,10 @@ function wp_finalize_template_enhancement_output_buffer( string $output, int $ph
9961000
* {@see 'wp_template_enhancement_output_buffer'} filter added, or if the
9971001
* {@see 'wp_should_output_buffer_template_for_enhancement'} filter is made to return `true`.
9981002
*
1003+
* Important: Because this action fires inside an output buffer callback (i.e. display handler), any callbacks added
1004+
* to the action must not attempt to start their own output buffers. Otherwise, PHP will raise a fatal error:
1005+
* "Cannot use output buffering in output buffering display handlers."
1006+
*
9991007
* @since 6.9.0
10001008
*
10011009
* @param string $output Finalized output buffer.

0 commit comments

Comments
 (0)