Skip to content

Commit 2453a6b

Browse files
committed
Cron: Cast doing_cron transient to a float.
Cast the `doing_cron` transient value to a float to prevent type errors if the transient is not set (in which case it returns `false`) or another unexpected type. Props fzhantw, ankitmaru. Fixes #58471. git-svn-id: https://develop.svn.wordpress.org/trunk@56553 602fd350-edb4-49c9-b593-d223f7449a82
1 parent aeba9d1 commit 2453a6b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wp-includes/cron.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ function spawn_cron( $gmt_time = 0 ) {
863863
* Multiple processes on multiple web servers can run this code concurrently,
864864
* this lock attempts to make spawning as atomic as possible.
865865
*/
866-
$lock = get_transient( 'doing_cron' );
866+
$lock = (float) get_transient( 'doing_cron' );
867867

868868
if ( $lock > $gmt_time + 10 * MINUTE_IN_SECONDS ) {
869869
$lock = 0;

0 commit comments

Comments
 (0)