Make WordPress Core

Opened 16 months ago

Last modified 16 months ago

#58041 new defect (bug)

Fix non-strict checking issue on /wp-admin/includes/upgrade.php file

Reported by: faisalahammad's profile faisalahammad Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.3
Component: General Keywords: has-patch
Focuses: coding-standards Cc:

Description

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:

<?php
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.

Change History (1)

This ticket was mentioned in PR #4277 on WordPress/wordpress-develop by @faisalahammad.


16 months ago
#1

  • Keywords has-patch added; needs-patch removed

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:

{{{php
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.

Trac ticket: https://core.trac.wordpress.org/ticket/58041

Note: See TracTickets for help on using tickets.