[wp-trac] [WordPress Trac] #22239: wp_ob_end_flush_all() tries to destroy non-destroyable output buffers

WordPress Trac noreply at wordpress.org
Tue Jul 15 06:37:37 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 reported-upstream       |
-------------------------------------------------+-------------------------

Comment (by abcd95):

 == Test Report
 === Description

 ✅ This report validates that the indicated patch works as expected.

 Patch tested: https://github.com/WordPress/wordpress-
 develop/pull/5771.patch

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.25
 - Server: nginx/1.27.2
 - Database: mysqli (Server: 8.4.4 / Client: mysqlnd 8.2.25)
 - Browser: Chrome 138.0.0.0
 - OS: macOS
 - Theme: Twenty Twenty-Five 1.2


 === Reproduction Steps


 - Enable WordPress debug logging
 - Create a non-removable output buffer using `ob_start($callback, 0, 0)`,
 where the third parameter `(0)` makes the buffer non-removable
 - Call `wp_ob_end_flush_all()` to trigger the issue
 - Check the debug logs for PHP notices/warnings


 === Actual Results

 ✅ Issue resolved with patch.

 === Additional Notes


 The test created a non-removable output buffer using PHP's `ob_start()`
 function with the erasure flag set to `0`:

 {{{
 ob_start(function($output) {
     return $output;
 }, 0, 0);
 }}}

 This creates a buffer that cannot be removed, simulating the same
 conditions that occur with extensions like New Relic or
 zlib.output_compression. The buffer status was verified using
 `ob_get_status()` to confirm the `PHP_OUTPUT_HANDLER_REMOVABLE` flag was
 not set (same as the patch does).

 [https://i.ibb.co/7xDYrdZ1/Screenshot-2025-07-15-at-10-57-17.png
 Screenshot of the warning appearing without the patch applied], which
 disappeared after applying the patch.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/22239#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list