From ad9366c737fdf82f242e80ec3f95434e4626f1f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Robin?= Date: Mon, 10 Feb 2025 02:10:55 +0100 Subject: [PATCH] Closes #6993: Add a condition to bailout (#7251) --- inc/Engine/Optimization/RegexTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/Engine/Optimization/RegexTrait.php b/inc/Engine/Optimization/RegexTrait.php index e117df96c57..7410f915432 100644 --- a/inc/Engine/Optimization/RegexTrait.php +++ b/inc/Engine/Optimization/RegexTrait.php @@ -144,7 +144,7 @@ protected function replace_html_comment( $match ) { // phpcs:ignore Universal.Na * @return string */ protected function restore_html_comments( $html ) { - if ( empty( $this->html_replace ) ) { + if ( ! is_string( $html ) || empty( $this->html_replace ) ) { // @phpstan-ignore-line For some reason, html could be null for some users, and we can't find a way to reproduce it. return $html; }