- Affected version
- 2.3.10
This will only affect you if you are saving a new cron or edit it outside of the hour(s) is should run in later. It also occurs, when updating (and most likely) installing an add-on, no matter if the cron has changed or not. After the first routine run of such a cron job (see below), I assume everything should work as expected.
Here's a screenshot as example:

Before hour
But XF is not fully prepared for this use case, so it shows after saving the cron entry the right hour, but the "current minute + 1" as "next run".
Screenshot (my timestamp 02:38 is UTC 00:38 and 2 hours from now; real next run should be at 02:00 my timezone):

In the
This leads us to this code in the
and:
I have no suggested fix for this for now..
Here's a screenshot as example:

Before hour
0 UTC the column next_run in the xf_cron_entry database table, should show minute 0.But XF is not fully prepared for this use case, so it shows after saving the cron entry the right hour, but the "current minute + 1" as "next run".
Screenshot (my timestamp 02:38 is UTC 00:38 and 2 hours from now; real next run should be at 02:00 my timezone):

In the
CronEntry entity we have in the _preSave() method this line:
PHP:
$this->set('next_run', $this->calculateNextRun());
This leads us to this code in the
CalculateNextRunService:
PHP:
public function calculateNextRunTime(array $runRules, $currentTime = null)
{
$currentTime = ($currentTime ?? \XF::$time);
$nextRun = new \DateTime('@' . $currentTime);
$nextRun->modify('+1 minute');
if (empty($runRules['minutes']))
{
$runRules['minutes'] = [-1];
}
$this->modifyRunTimeMinutes($runRules['minutes'], $nextRun);
if (empty($runRules['hours']))
{
$runRules['hours'] = [-1];
}
$this->modifyRunTimeHours($runRules['hours'], $nextRun);
if (!empty($runRules['day_type']))
{
if ($runRules['day_type'] == 'dow')
{
if (empty($runRules['dow']))
{
$runRules['dow'] = [-1];
}
$this->modifyRunTimeDayOfWeek($runRules['dow'], $nextRun);
}
else
{
if (empty($runRules['dom']))
{
$runRules['dom'] = [-1];
}
$this->modifyRunTimeDayOfMonth($runRules['dom'], $nextRun);
}
}
return intval($nextRun->format('U'));
}
and:
PHP:
protected function modifyRunTimeMinutes(array $minuteRules, \DateTime &$nextRun)
{
$currentMinute = $nextRun->format('i');
$this->modifyRunTimeUnits($minuteRules, $nextRun, $currentMinute, 'minute', 'hour');
}
I have no suggested fix for this for now..