Skip to content

Commit

Permalink
WP Super Cache: if there is an output buffer active do not create ano…
Browse files Browse the repository at this point in the history
…ther one (#36124)

* Check if an output buffer is active before setting one up

* changelog

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8137108292
  • Loading branch information
donnchawp authored and matticbot committed Mar 4, 2024
1 parent 8ac0c0f commit bd2c935
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ This is an alpha version! The changes listed here are not final.
- Super Cache: with rebuild enabled, apply that to subdirectories instead of deleting them.
- WP Super Cache - fix the wp_super_cache_clear_post_cache so the homepage cache isn't deleted too.
- WP Super Cache: bail if the request uri isn't set. It means the plugin isn't configured yet.
- WP Super Cache: don't create an output buffer if there's already one active

## [1.11.0] - 2023-11-08
### Added
Expand Down
10 changes: 10 additions & 0 deletions wp-cache-phase2.php
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,16 @@ function wp_cache_phase2() {
return false;
}

if ( ob_get_level() > 0 ) {
global $wp_super_cache_late_init;
$ob_warning = 'Already in an output buffer. Check your plugins, themes, mu-plugins, and other custom code. Exit.';
if ( isset( $wp_super_cache_late_init ) && $wp_super_cache_late_init ) {
$ob_warning = 'Late init enabled. Disable it. ' . $ob_warning;
}
wp_cache_debug( 'wp_cache_phase2: ' . $ob_warning );
return;
}

wp_cache_debug( 'In WP Cache Phase 2', 5 );

$wp_cache_gmt_offset = get_option( 'gmt_offset' ); // caching for later use when wpdb is gone. https://wordpress.org/support/topic/224349
Expand Down

0 comments on commit bd2c935

Please sign in to comment.