[wp-trac] [WordPress Trac] #64404: Uncaught DivisionByZeroError: Modulo by zero
WordPress Trac
noreply at wordpress.org
Thu Dec 11 20:33:45 UTC 2025
#64404: Uncaught DivisionByZeroError: Modulo by zero
----------------------------+-----------------------------
Reporter: kaushiksomaiya | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cron API | Version:
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
Hello team,
It seems there's a possibility of plugins or custom code inadvertently
inserting boolean value in custom schedule intervals. When that happens -
Cron breaks badly even after removal of the custom code/plugin declaring
it. This is because there's an attempt to reschedule the event before
executing it.. and probably if ( 0 === $interval ) { doesn't evaluate true
for the bool value.
To Replicate:
{{{
// 1. Add a broken schedule
add_filter( 'cron_schedules', function( $schedules ) {
// INTENTIONALLY BROKEN
$schedules['kscronbreaker_cron_schedule'] = array(
'interval' => false, // ❌ Wrong: must be integer > 0
'display' => 'Broken Cron Schedule',
);
return $schedules;
} );
// 2. Try to schedule the event
add_action( 'init', function() {
if ( ! wp_next_scheduled( 'kscronbreaker_broken_cron_hook' ) ) {
wp_schedule_event(
time() + 10,
'kscronbreaker_cron_schedule',
'kscronbreaker_broken_cron_hook'
);
}
} );
// 3. Cron handler (never runs)
add_action( 'kscronbreaker_broken_cron_hook', function() {
error_log( 'KS Cron Breaker executed — THIS SHOULD NEVER APPEAR' );
} );
}}}
Then check the server's fatal error logs
Uncaught DivisionByZeroError: Modulo by zero in /wp-5351423/wp-
includes/cron.php:436
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64404>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list