Make WordPress Core

Opened 22 months ago

Closed 22 months ago

Last modified 22 months ago

#58040 closed defect (bug) (fixed)

Replace non-strict checking in /wp-admin/users.php file

Reported by: faisalahammad's profile faisalahammad Owned by: audrasjb's profile 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

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

#2 @audrasjb
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.

#3 @SergeyBiryukov
22 months ago

  • Component changed from General to Users

#4 @audrasjb
22 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 55623:

Coding Standards: Use strict comparison in wp-admin/users.php.

Follow-up to [10990], [11162], [11217], [37059], [55592], [55622].
Props faisalahammad.
Fixes #58040.

Note: See TracTickets for help on using tickets.