Skip to content

Commit

Permalink
Protect Status: prevent undefined extension warning (#40622)
Browse files Browse the repository at this point in the history
  • Loading branch information
nateweller authored Dec 18, 2024
1 parent 3ed576d commit 988bafb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix PHP warnings caused by uninstalled extensions.
2 changes: 1 addition & 1 deletion projects/packages/protect-status/src/class-scan-status.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 988bafb

Please sign in to comment.