From 46419c5b8573951bdfbc82a4c57e6c70cc9a2a02 Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Thu, 2 Jun 2022 13:15:29 -0300 Subject: [PATCH] WP-CLI index timers: Cast values to float --- includes/classes/Command.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/classes/Command.php b/includes/classes/Command.php index a3689be3ee..0d296a78f1 100644 --- a/includes/classes/Command.php +++ b/includes/classes/Command.php @@ -1530,7 +1530,7 @@ protected function timer_start() { */ protected function timer_stop( $precision = 3 ) { $diff = microtime( true ) - $this->time_start; - return number_format( $diff, $precision ); + return (float) number_format( (float) $diff, $precision ); } /** @@ -1542,7 +1542,7 @@ protected function timer_stop( $precision = 3 ) { * @return string */ protected function timer_format( $microtime, $format = 'H:i:s.u' ) { - $microtime_date = \DateTime::createFromFormat( 'U.u', number_format( $microtime, 3, '.', '' ) ); + $microtime_date = \DateTime::createFromFormat( 'U.u', number_format( (float) $microtime, 3, '.', '' ) ); return $microtime_date->format( $format ); }