From 18753eb0c6c85b3e0dc81a6266226563aa1c62a2 Mon Sep 17 00:00:00 2001 From: Jake Morrison <68693+jom@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:36:46 -0500 Subject: [PATCH 1/4] fix: hide debug HTML comments in REST and Ajax responses --- wp-cache-phase2.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/wp-cache-phase2.php b/wp-cache-phase2.php index d3c5ce3d..5ff03953 100644 --- a/wp-cache-phase2.php +++ b/wp-cache-phase2.php @@ -2210,7 +2210,14 @@ function wp_cache_append_tag( &$buffer ) { $msg = "Live page served on $timestamp"; } - if ( strpos( $buffer, ' Date: Tue, 7 Apr 2026 17:24:36 -0500 Subject: [PATCH 2/4] fix: clarify debug comment suppression messages --- wp-cache-phase2.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-cache-phase2.php b/wp-cache-phase2.php index 5ff03953..dc58b271 100644 --- a/wp-cache-phase2.php +++ b/wp-cache-phase2.php @@ -2210,7 +2210,7 @@ function wp_cache_append_tag( &$buffer ) { $msg = "Live page served on $timestamp"; } - // Don't output debug message if we aren't handling a normal HTML response. + // Don't append debug HTML comments to non-HTML responses (REST, Ajax, etc.). if ( strpos( $buffer, ' Date: Wed, 27 May 2026 17:25:44 +0100 Subject: [PATCH 3/4] Extract wpsc_skip_debug_output() to de-duplicate the non-HTML response check The REST/Ajax/JSON/WC bail condition was copy-pasted into both wp_cache_append_tag() and wp_cache_add_to_buffer(). Move it into a single named predicate so the two call sites can't drift, and drop the explanatory comment the inline condition needed. --- wp-cache-phase2.php | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/wp-cache-phase2.php b/wp-cache-phase2.php index dc58b271..5c6fa0b3 100644 --- a/wp-cache-phase2.php +++ b/wp-cache-phase2.php @@ -2191,6 +2191,14 @@ function wp_cache_ob_callback( $buffer ) { } } +function wpsc_skip_debug_output( $buffer ) { + return strpos( $buffer, ' Date: Wed, 27 May 2026 17:31:28 +0100 Subject: [PATCH 4/4] Also skip debug comments on XML-RPC requests advanced-cache.php already treats XMLRPC_REQUEST as a non-HTML response type; keep wpsc_skip_debug_output() consistent so XML-RPC bodies stay clean regardless of the