Opened 7 months ago
Last modified 2 months ago
#57030 assigned defect (bug)
Condition is not strictly checked on options-general.php file
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Administration | Keywords: | has-patch |
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 (4)
This ticket was mentioned in PR #3580 on WordPress/wordpress-develop by @rakibwordpress.
7 months ago
#1
#2
follow-up:
↓ 4
@
3 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
@
3 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
@
2 months ago
Replying to hellofromTonya:
Also a note for consideration:
Will$current_offset
always be an integer0
? 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
.
Trac ticket: