-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
range(): step exceeds the specified range #88
Comments
|
In PHP 8, this Until then, it needs to handled in the code. |
Obviously the cron string is nonsensical - but still valid so it should not throw an error. |
Within the bounds of this library, it's invalid. What happens with a step larger than the range is ambiguous - does it wrap around, does it only run the first, does it truncate? Some libraries handle it, some do not. This would be the intended error. Your intended step is too large, and will not function, so the error is thrown. It's better to have the error letting you know the cron is invalid than let it "run" with unintended results. |
Reopening, because 2 years ago I validated the cronie allowed wrap-around steps. Since this library follows cronie, the larger step should wrap around to the beginning and continue counting. This looks like a break between validation and when we do the stepping on small ranges versus |
Sorry this took so long. It's actually a few different subtle issues that dealt wit "how much can break." So, cronie supports steps larger than a range, but it doesn't actually wrap around. Internally it's using a This library does have, incorrectly, some logic to handle wrapping around. That will be going away. I fixed this particular bug with the correct behavior, so if you specify a range that is smaller than max, but a step that is larger than the small range, you will only ever match against the first value in the range. So given So given a run date of
This is fixed in |
This should be fixed with v3.2.2 |
@dragonmantank
I'm using v2 of library:
Error:
range(): step exceeds the specified range
/vendor/dragonmantank/cron-expression/src/Cron/AbstractField.php:148
/vendor/dragonmantank/cron-expression/src/Cron/AbstractField.php:53
/vendor/dragonmantank/cron-expression/src/Cron/MinutesField.php:31
/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php:362
/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php:199
The text was updated successfully, but these errors were encountered: