From d208759385d08c28a63ff4202701427f76690774 Mon Sep 17 00:00:00 2001 From: Juanma Rodriguez Escriche Date: Wed, 8 May 2024 08:40:01 +0200 Subject: [PATCH] Status package add is string check to compat check (#37256) * Added is_string check prior to using str_starts_with * Changelog --- ...update-status-package-add-is-string-checkt-to-compat-check | 4 ++++ projects/packages/status/src/class-modules.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 projects/packages/status/changelog/update-status-package-add-is-string-checkt-to-compat-check diff --git a/projects/packages/status/changelog/update-status-package-add-is-string-checkt-to-compat-check b/projects/packages/status/changelog/update-status-package-add-is-string-checkt-to-compat-check new file mode 100644 index 0000000000000..41313599c8251 --- /dev/null +++ b/projects/packages/status/changelog/update-status-package-add-is-string-checkt-to-compat-check @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Status: Added check for compatibility reasons diff --git a/projects/packages/status/src/class-modules.php b/projects/packages/status/src/class-modules.php index 0755e0251bb5c..f886ca165c4c6 100644 --- a/projects/packages/status/src/class-modules.php +++ b/projects/packages/status/src/class-modules.php @@ -166,7 +166,7 @@ public function get_file_data( $file, $headers ) { } $key = md5( $file_name . maybe_serialize( $headers ) ); - $refresh_cache = is_admin() && isset( $_GET['page'] ) && str_starts_with( $_GET['page'], 'jetpack' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput + $refresh_cache = is_admin() && isset( $_GET['page'] ) && is_string( $_GET['page'] ) && str_starts_with( $_GET['page'], 'jetpack' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput // If we don't need to refresh the cache, and already have the value, short-circuit! if ( ! $refresh_cache && isset( $file_data_option[ $key ] ) ) {