[wp-trac] [WordPress Trac] #57924: _set_cron_array called with incorrect crons

WordPress Trac noreply at wordpress.org
Tue Mar 14 22:13:57 UTC 2023


#57924: _set_cron_array called with incorrect crons
--------------------------+-----------------------------
 Reporter:  j3gaming      |      Owner:  j3gaming
     Type:  defect (bug)  |     Status:  assigned
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Cron API      |    Version:  6.1.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 **Problem:**
 In wp-includes/cron.php _set_cron_array( $cron, $wp_error = false ) is
 rarely called without every cron task in the $cron parameter. Eventually
 leading to a random one being deleted by update_option('cron', $cron);

 **Expected Behaviour:**
 (Assuming 22 total crons)

 wp_schedule_event( ... ) runs.
 Passing in a total count of 23 $crons into _set_cron_array( $crons,
 $wp_error );
 (not sure why it's +1 the total cron count)

 wp_unschedule_event( ... ) runs.
 Passing in a total count of 22 $crons into _set_cron_array( $crons,
 $wp_error );
 (I assume the one from the previous call is being removed)

 Then the cron is executed. Ready for the next time.

 **The Bug:**
 RARELY, the incorrect amount is passed, causing a series of events, that
 deletes the cron entirely.

 I am debugging this myself as I can make this happen regularly and will
 continue to log my progress here. I am hoping to fix this myself for the
 community, I'm also posting to see if anything has been flagged in the
 past to give me a head start.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57924>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list