From 78a0c7a5b3d42bbeea620476129e3d04ec37598f Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Thu, 22 Aug 2024 23:27:24 +0000 Subject: [PATCH] Date/Time: Prevent type errors in `current_time()`. Prevents a potential type error when calling `current_time( 'timestamp' )` by casting `get_option( 'gmt_offset' )` 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 [45856], [55054], [55598]. Props hellofromtonya, peterwilsoncc, rarst, costdev, Nick_theGeek, SergeyBiryukov, johnbillion, desrosj, reputeinfosystems, audrasjb, oglekler. Fixes #57035. Built from https://develop.svn.wordpress.org/trunk@58923 git-svn-id: http://core.svn.wordpress.org/trunk@58319 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 16be10713f..6ddd11f071 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -73,7 +73,7 @@ function mysql2date( $format, $date, $translate = true ) { function current_time( $type, $gmt = 0 ) { // Don't use non-GMT timestamp, unless you know the difference and really need to. if ( 'timestamp' === $type || 'U' === $type ) { - return $gmt ? time() : time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ); + return $gmt ? time() : time() + (int) ( (float) get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ); } if ( 'mysql' === $type ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index d678e5d561..c4b96a8cf3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-58922'; +$wp_version = '6.7-alpha-58923'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.