[wp-trac] [WordPress Trac] #64108: Triggered errors are not displayed when applying template enhancement output buffer filters
WordPress Trac
noreply at wordpress.org
Thu Oct 16 18:56:21 UTC 2025
#64108: Triggered errors are not displayed when applying template enhancement
output buffer filters
--------------------------+-------------------------
Reporter: westonruter | Owner: westonruter
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.9
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-------------------------
This is follow up to #43258.
Attempting to `echo` during a user output buffer callback does not add
anything to the output, and this is now deprecated in PHP 8.5 as
[https://core.trac.wordpress.org/ticket/43258#comment:73 discovered] by
@swissspidy (see initial fix in [60945]), and was
[https://core.trac.wordpress.org/ticket/43258#comment:74 noted] by
@jorbin:
> More info on the deprecation: https://github.com/php/php-
src/commit/07f1cfd9b01ff0f3720c1a5580b9e263eec5fce1 and
https://wiki.php.net/rfc/deprecations_php_8_4#:~:text=has%20been%20closed.-,Deprecate%20producing%20output%20in%20a%20user%20output%20handler,buffering%20function%20in%20an%20output%20handler%20will%20emit%20a%20Fatal%20Error.,-Deprecate%20producing%20output
Of note:
> '''Deprecate producing output in a user output handler'''
>
> Because an output handler should just be manipulating the incoming
buffer, any output that it produces is discarded. As such, issues within
an output handler can go unnoticed and be hard to debug.
>
> Therefore, we propose deprecating producing any output in an output
handler, in the same way as attempting to use an output buffering function
in an output handler will emit a Fatal Error.
Currently when `WP_DEBUG_DISPLAY` is enabled (and thus `display_errors` is
on), calls to `_doing_it_wrong()` and `wp_trigger_error()` in callbacks
for the `wp_template_enhancement_output_buffer` filter are problematic. In
reality, this has been a problem already for plugins that open their own
output buffers and either trigger errors in their output buffer callback
or provide extensibility for other plugins which can cause errors.
We should better handle errors triggered during a user output handler. We
capture with an error handler and then when `display_errors` is on we can
append the errors as HTML to the response.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64108>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list