Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Cron_Event_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,20 +185,20 @@ public function schedule( $args, $assoc_args ) {
WP_CLI::error( sprintf( "'%s' is not a valid datetime.", $next_run ) );
}

if ( ! empty( $recurrence ) ) {
$cron_args = $assoc_args;
Comment thread
swissspidy marked this conversation as resolved.
Outdated
ksort( $cron_args );
$cron_args = array_values( $cron_args );

Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new normalization of hook arguments (sorting by key and reindexing with array_values) changes behavior when users pass numeric arguments out of order (e.g. --1=... --0=...). There’s existing Behat coverage for scheduling with args, but it doesn’t assert this normalization behavior; please add/extend a functional scenario to cover ordering normalization so regressions are caught.

Copilot uses AI. Check for mistakes.
if ( ! empty( $recurrence ) ) {
$schedules = wp_get_schedules();

if ( ! isset( $schedules[ $recurrence ] ) ) {
WP_CLI::error( sprintf( "'%s' is not a valid schedule name for recurrence.", $recurrence ) );
}

$event = wp_schedule_event( $timestamp, $recurrence, $hook, $assoc_args );

$event = wp_schedule_event( $timestamp, $recurrence, $hook, $cron_args );
} else {

$event = wp_schedule_single_event( $timestamp, $hook, $assoc_args );

$event = wp_schedule_single_event( $timestamp, $hook, $cron_args );
}

if ( false !== $event ) {
Expand Down
Loading