From 89abf62b31397204d388a43ff1855a3a6705f581 Mon Sep 17 00:00:00 2001 From: Faisal Ahammad Date: Sat, 1 Apr 2023 18:07:12 +0600 Subject: [PATCH] Fix non-strict checking issue on /wp-admin/includes/upgrade.php file This PR fixes a non-strict checking issue on line 1419 of the /wp-admin/includes/upgrade.php file in WordPress core. The current code uses the "==" operator instead of the "===" operator, which can lead to unexpected behavior due to type coercion. To fix this issue, we replace the "==" operator with the "===" operator to perform a strict comparison between the value of the $link->link_category variable and the integer 0. This ensures that the comparison is done in a type-safe way and that unexpected behavior is avoided. The fixed code is as follows: `if ( 0 === $link->link_category ) ) { continue; }` With this fix, the code in the upgrade.php file will be more reliable and less prone to unexpected behavior. --- src/wp-admin/includes/upgrade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 5bfc154f251f7..0a382ed4392e4 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -1416,7 +1416,7 @@ function upgrade_230() { $links = $wpdb->get_results( "SELECT link_id, link_category FROM $wpdb->links" ); if ( ! empty( $links ) ) { foreach ( $links as $link ) { - if ( 0 == $link->link_category ) { + if ( 0 === $link->link_category ) { continue; } if ( ! isset( $link_cat_id_map[ $link->link_category ] ) ) {