Skip to content

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

Open
faisalahammad wants to merge 2 commits intoWordPress:trunkfrom
faisalahammad:58041
Open

Fix non-strict checking issue on /wp-admin/includes/upgrade.php file#4277
faisalahammad wants to merge 2 commits intoWordPress:trunkfrom
faisalahammad:58041

Conversation

@faisalahammad
Copy link

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.

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


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant