You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Month field: */123 is invalid, but $monthField->validate return true.
The same situation with other fields. Actually you can get an error only when using CronExpression's getNextRunDate method - "Step cannot be greater than total range" .
And why this code cause an exception?
$cron = CronExpression::factory('* * * */12 *');
$cron->getNextRunDate();
// Throws an ErrorException: "range(): step exceeds the specified range"
The text was updated successfully, but these errors were encountered:
Can you verify which version of the library you are using for the first test? */123 should return false on a validation test. I was wrong on that, it failed with a patch for the second part of this. Will fix.
The second error is a bit more involved. "Month" is a range for 1-12, with 12 elements. When you pass * as the range, it gets expanded as 1-12, and then the step is applied. So starting at the first element (1), add the step (12). That results in 13, which is outside of the range of 1-12.
What you probably expect to happen is that the value "wraps" around the end and goes back to 1. I will see what I can do about this. Thanks!
I verified that cronie will actually accept a step larger than the range of a field, so that was good.
Steps that generate numbers that are larger than the actual range of a field should now wrap around back to the beginning of the range with the above commit. So */123 will now validate as well as generate a correct date for getting next runs, previous runs, or checking if a cron is due.
For example:
Month field: */123 is invalid, but $monthField->validate return true.
The same situation with other fields. Actually you can get an error only when using CronExpression's getNextRunDate method - "Step cannot be greater than total range" .
And why this code cause an exception?
The text was updated successfully, but these errors were encountered: