[wp-trac] [WordPress Trac] #22239: wp_ob_end_flush_all() tries to destroy non-destroyable output buffers
WordPress Trac
noreply at wordpress.org
Thu May 22 00:50:15 UTC 2025
#22239: wp_ob_end_flush_all() tries to destroy non-destroyable output buffers
-------------------------------------------------+-------------------------
Reporter: dd32 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future
| Release
Component: Bootstrap/Load | Version: 2.2
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests dev- | Focuses:
feedback has-test-info |
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* keywords: has-patch needs-testing has-unit-tests => has-patch has-unit-
tests dev-feedback has-test-info
Comment:
== Test Report
=== Description
✅ This report validates that the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-
develop/pull/5771.diff
=== Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.27.5
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 136.0.0.0
- OS: Windows 10/11
- Theme: Twenty Nineteen 3.1
- MU Plugins: None activated
- Plugins:
* Test Reports 1.2.0
=== Reproduction Steps
1. First, `zlib.output_compression = 1` should be added to `php.ini` in
the server. Otherwise, it will not happen. In `wordpress-develop` add it
to `tools/local-env/php-config.ini`. The OP was referring to New Relic,
that according to the
[https://web.archive.org/web/20130117025541/https://newrelic.com/docs/php
/php-agent-faq Archive], it seems that also deals with zlib.
2. Now simply add the code attached in Artifacts, wherever it can be
executed in WP (a plugin, functions.php, you name it)
3. 🐞 The first part of the code triggers the notice: `( ! ) Notice:
ob_end_flush(): Failed to send buffer of my_ob_cb (1) in /var/www/src/wp-
includes/functions.php on line 5470`
=== Expected Results
- Notice should be handled
=== Actual Results
1. ✅ Issue resolved with patch.
=== Additional Notes
- ⚠️ The only problem is what @kkmuffme mentions: He cannot really unit
test the error here with `ob_start(callable,0,0)`, because of a limitation
in PHPUnit. I wonder how this is handled. I suppose that the committer
should subscribe to the GitHub issue to see if there
[https://github.com/sebastianbergmann/phpunit/issues/5851 are any changes
in the future] and update unit tests to remove the skipped part.
- The original solution by @dd32 was not great because it did not handle
the problem, it only ignored it.
- @jorbin, apart from this issue, this patch is ready to be shipped.
=== Supplemental Artifacts
Code for testing
{{{
function my_ob_cb( $output ) {
return $output;
}
ob_start( 'my_ob_cb', 0, 0 );
function my_ob_cb2( $output ) {
return $output;
}
ob_start( 'my_ob_cb2' );
echo 'Hello';
ob_end_flush();
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/22239#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list