#58040 closed defect (bug) (fixed)
Replace non-strict checking in /wp-admin/users.php file
Reported by: | faisalahammad | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Users | Keywords: | has-patch |
Focuses: | coding-standards | Cc: |
Description
This PR replaces a non-strict checking issue on line 362 of the /wp-admin/users.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 $go_delete variable and the integer 1. 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 ( 1 === $go_delete ) : ?>
With this fix, the code in the users.php file will be more reliable and less prone to unexpected behavior.
Change History (5)
This ticket was mentioned in PR #4275 on WordPress/wordpress-develop by @faisalahammad.
22 months ago
#1
- Keywords has-patch added; needs-patch removed
#2
@
22 months ago
- Milestone changed from Awaiting Review to 6.3
- Owner set to audrasjb
- Status changed from new to accepted
- Version trunk deleted
Hello and thanks for the PR @faisalahammad,
The patch looks good to me, $go_delete
can only contain an integer value and is not filtrable, so strict comparison is welcome.
Moving this to milestone 6.3.
@audrasjb commented on PR #4275:
22 months ago
#5
committed in https://core.trac.wordpress.org/changeset/55623
This PR replaces a non-strict checking issue on line 362 of the /wp-admin/users.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 $go_delete variable and the integer 1. 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 ( 1 === $go_delete ) : ?>
With this fix, the code in the users.php file will be more reliable and less prone to unexpected behavior.
Trac ticket: https://core.trac.wordpress.org/ticket/58040