From 26cf62a07b1bba8355b1c4bd079a341feba1d5d9 Mon Sep 17 00:00:00 2001 From: Nate Weller Date: Sun, 15 Dec 2024 13:02:46 -0700 Subject: [PATCH 1/2] Protect Status: fix possible undefined array key warning --- projects/packages/protect-status/src/class-scan-status.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/packages/protect-status/src/class-scan-status.php b/projects/packages/protect-status/src/class-scan-status.php index 32deca2eba526..6f743cc397b63 100644 --- a/projects/packages/protect-status/src/class-scan-status.php +++ b/projects/packages/protect-status/src/class-scan-status.php @@ -243,7 +243,7 @@ private static function normalize_api_data( $scan_data ) { // Theme and Plugin Threats if ( ! empty( $scan_threat->extension ) && in_array( $scan_threat->extension->type, array( 'plugin', 'theme' ), true ) ) { - $installed_extension = 'plugin' === $scan_threat->extension->type ? $plugins[ $scan_threat->extension->slug ] : $themes[ $scan_threat->extension->slug ]; + $installed_extension = 'plugin' === $scan_threat->extension->type ? ( $plugins[ $scan_threat->extension->slug ] ?? null ) : ( $themes[ $scan_threat->extension->slug ] ?? null ); // If the extension is no longer installed, skip this threat. // todo: use version_compare() From 92e52191eddda5017bd6c2cc695fe144eac62835 Mon Sep 17 00:00:00 2001 From: Nate Weller Date: Sun, 15 Dec 2024 13:03:47 -0700 Subject: [PATCH 2/2] changelog --- .../changelog/fix-php-undefined-array-key-warning | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/packages/protect-status/changelog/fix-php-undefined-array-key-warning diff --git a/projects/packages/protect-status/changelog/fix-php-undefined-array-key-warning b/projects/packages/protect-status/changelog/fix-php-undefined-array-key-warning new file mode 100644 index 0000000000000..72562089ff171 --- /dev/null +++ b/projects/packages/protect-status/changelog/fix-php-undefined-array-key-warning @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fix PHP warnings caused by uninstalled extensions.