Make WordPress Core

Opened 22 months ago

Last modified 6 months ago

#56172 new defect (bug)

Strict comparisons not used.

Reported by: hilayt24's profile hilayt24 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords: needs-patch dev-feedback
Focuses: coding-standards Cc:

Description

On going through the core files, I observed that in many places strict comparison is not used. After that, I ran the code through the WPCS and also got the warnings for the same. Though it does not affect the flow of the site, it should be used.

Few exampals are:

1 options-general.php

 215 | WARNING | Found: ==. Use strict comparisons (=== or !==).
 393 | WARNING | Found: ==. Use strict comparisons (=== or !==).

2 sites.php

 105 | WARNING | Found: ==. Use strict comparisons (=== or !==).
 145 | WARNING | Found: !=. Use strict comparisons (=== or !==).
 145 | WARNING | Found: !=. Use strict comparisons (=== or !==).
 157 | WARNING | Found: ==. Use strict comparisons (=== or !==).
 185 | WARNING | Found: !=. Use strict comparisons (=== or !==).
 185 | WARNING | Found: !=. Use strict comparisons (=== or !==).

Change History (2)

#1 @audrasjb
22 months ago

  • Focuses coding-standards added
  • Keywords needs-refresh removed

#2 @sabernhardt
6 months ago

Those two comparisons in wp-admin/options-general.php both involve output of get_option():

  • ( 0 == $current_offset ) - line 245
  • ( get_option( 'start_of_week' ) == $day_index ) - line 445

The six comparisons in wp-admin/network/sites.php were updated in [55672] and [55876].

Note: See TracTickets for help on using tickets.