Make WordPress Core


Ignore:
Timestamp:
09/18/2024 10:35:35 PM (9 months ago)
Author:
peterwilsoncc
Message:

Date/Time, PHP Compat: Prevent type errors using GMT offset option.

Prevents a potential type errors when making use of the gmt_offset option by casting the value to a float prior to performing calculations with the value.

This mainly accounts for incorrect storage of values, such as an empty string or city name.

Follow up to [58923].

Props chaion07, hellofromtonya, kirasong, mhshohel, mukesh27, nicolefurlan, nihar007, nurielmeni, oglekler, peterwilsoncc, prionkor, rajinsharwar, rarst, rleeson, sabernhardt, SergeyBiryukov, swissspidy, toastercookie, verygoode.
Fixes #56358, #58986, #60629.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/update-core.php

    r57793 r59064  
    10971097
    10981098    if ( $current && isset( $current->last_checked ) ) {
    1099         $last_update_check = $current->last_checked + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
     1099        $last_update_check = $current->last_checked + (int) ( (float) get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
    11001100    }
    11011101
Note: See TracChangeset for help on using the changeset viewer.