Make WordPress Core

Opened 18 months ago

Last modified 10 months ago

#57030 assigned defect (bug)

Condition is not strictly checked on options-general.php file

Reported by: rakibwordpress's profile rakibwordpress Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: Future Release Priority: normal
Severity: normal Version: 3.0
Component: Administration Keywords: has-patch changes-requested needs-unit-tests
Focuses: coding-standards Cc:

Description

In options-general.php file it is 0 is being compared with another variable which is $current_offset. As 0 is numeric value this needs to be compared.

Change History (7)

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


18 months ago
#1

Trac ticket:

#2 follow-up: @hellofromTonya
14 months ago

  • Version changed from trunk to 3.0

Hello @rakibwordpress,

Welcome back to WordPress Core's Trac!

I'm doing some triage for open tickets against trunk to see if the defect was introduced in the 6.2.0 cycle. For this one, the code is from 3.0.0, introduced via [12507] / #11558. Changing the Version number.

Also a note for consideration:
Will $current_offset always be an integer 0? Or could it be a string '0'? The current code will type juggle to compare the values without comparing the data types.

What I'm wondering (haven't looked deeply into it):
Is there a strict requirement that 0 must be an integer data type?

If no, then === could cause a backwards-compatibility issue or break in the code when it's a string 0.

#3 @SergeyBiryukov
14 months ago

  • Component changed from General to Administration
  • Focuses coding-standards added; administration removed
  • Milestone changed from Awaiting Review to 6.3
  • Owner set to SergeyBiryukov
  • Status changed from new to assigned

#4 in reply to: ↑ 2 @SergeyBiryukov
13 months ago

Replying to hellofromTonya:

Also a note for consideration:
Will $current_offset always be an integer 0? Or could it be a string '0'? The current code will type juggle to compare the values without comparing the data types.

This gets even more interesting, as the value can also be float or false, via wp_timezone_override_offset() hooked to pre_option_gmt_offset in wp-includes/default-filters.php.

This ticket was mentioned in Slack in #core by oglekler. View the logs.


10 months ago

#6 @oglekler
10 months ago

  • Keywords changes-requested needs-unit-tests added

This ticket was discussed in the recent bug scrub and due to lack of activity it was decided to move it into future release.

This ticket needs some additional work and unit test as well. It can be moved to the next available milestone when it will be ready.

Props: @Clorith @costdev

Last edited 10 months ago by oglekler (previous) (diff)

#7 @costdev
10 months ago

  • Milestone changed from 6.3 to Future Release

Moving to Future Release per the above comment.

Note: See TracTickets for help on using tickets.