[wp-trac] [WordPress Trac] #57030: Condition is not strictly checked on options-general.php file

WordPress Trac noreply at wordpress.org
Thu Jul 4 00:13:49 UTC 2024


#57030: Condition is not strictly checked on options-general.php file
-------------------------------------------------+-------------------------
 Reporter:  rakibwordpress                       |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.6
Component:  Administration                       |     Version:  3.0
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch changes-requested has-     |     Focuses:  coding-
  unit-tests close                               |  standards
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

 * status:  assigned => closed
 * resolution:   => fixed
 * milestone:  Future Release => 6.6


Comment:

 Replying to [comment:9 rajinsharwar]:
 > I guess this was solved via #60700 as the strict checks have already
 been implemented. Maybe we can close this.

 Good catch, thanks! This is now resolved in [57833] / #60700. I forgot
 about this ticket, sorry for  that.

 > Replying to [comment:4 SergeyBiryukov]:
 >
 > > 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`.
 >
 > I guess when the value is false, it currently works fine with the logic
 of `$tzstring = 'UTC+' . $current_offset`. And, I do not think the value
 will ever be float, given that the code is wrapped with the check of
 `empty( $tzstring )`.

 You're right. In my testing, `$current_offset` is actually a string here,
 since `wp_timezone_override_offset()` returning `false` in case of an
 empty timezone string means that `get_option()` proceeds to retrieve the
 value from the database. Now that the value is cast to an integer, the
 strict comparison works as expected.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57030#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list