From e0b8653ebd96c597f4293e96bdcd4424b0dbf7c4 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 9 Sep 2025 14:35:08 +1000 Subject: [PATCH 1/2] Title Check: Avoid Deprecated warnings when there's no file contents. --- checks/class-title-check.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/checks/class-title-check.php b/checks/class-title-check.php index 2d7bae69..b09c24b0 100644 --- a/checks/class-title-check.php +++ b/checks/class-title-check.php @@ -29,10 +29,12 @@ class Title_Check implements themecheck { */ public function check( $php_files, $css_files, $other_files ) { - $php = implode( ' ', $php_files ); - foreach ( $php_files as $file_path => $file_content ) { + if ( empty( $file_content ) ) { + continue; + } + // Check whether there is a call to wp_title(). checkcount(); if ( preg_match( '/\bwp_title\b/', $file_content ) ) { From 8030fb8f1fbe0ae184a6699c066b5da5111f61af Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Thu, 12 Mar 2026 08:22:43 +0100 Subject: [PATCH 2/2] Update class-title-check.php Check that file_content is a string, both before and after the preg_replace. --- checks/class-title-check.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/checks/class-title-check.php b/checks/class-title-check.php index b09c24b0..f76b8720 100644 --- a/checks/class-title-check.php +++ b/checks/class-title-check.php @@ -31,7 +31,7 @@ public function check( $php_files, $css_files, $other_files ) { foreach ( $php_files as $file_path => $file_content ) { - if ( empty( $file_content ) ) { + if ( ! is_string( $file_content ) || '' === $file_content ) { continue; } @@ -54,6 +54,10 @@ public function check( $php_files, $css_files, $other_files ) { // Look for anything that looks like ... and exclude it (inline svg's have titles too). $file_content = preg_replace( '/.*<\/svg>/s', '', $file_content ); + if ( ! is_string( $file_content ) ) { + continue; + } + // Look for and tags. checkcount(); if ( ( false !== strpos( $file_content, '' ) ) || ( false !== strpos( $file_content, '' ) ) ) {