mtdowling / cron-expression

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
http://mtdowling.com/blog/2012/06/03/cron-expressions-in-php/
MIT License
4.9k stars 336 forks source link

Incorrect expression #174

Closed donriga closed 5 years ago

donriga commented 5 years ago

0 0 12 1 1/2 ? *

At 12:00 PM, on day 1 of the month, every 2 months

Error: Fatal error: Uncaught InvalidArgumentException: 6 is not a valid position

dragonmantank commented 5 years ago

Hello @donriga !

This package is no longer being worked on, and has moved over to https://github.com/dragonmantank/cron-expression. If possible, please upgrade to the newest version of dragonmantank/cron-expression.

As for this issue, it looks like you have 7 parameters in your expression... depending on the version of his library you are using, you can only have 6 (with the 6th position being Year, which is now removed). The error is badly worded, as it's saying that the 6 position in the array is not valid, but it's counting starting at 0 like a normal PHP array.