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 335 forks source link

PSA: Tagging of the 1.2.2 branch caused issues with [insert framework or library] #176

Closed tfettig closed 4 years ago

tfettig commented 4 years ago

The commit 56e89730e60a0e945bf4ea10c48b80a406c7e7a0 got caught up the tagging of 1.2.2 and started Laravel 5.4.36 throwing exceptions.

This is a bit of the stack trace: Message: InvalidArgumentException: 5 is not a valid position

0 Cron\FieldFactory::getField called at [/var/app/current/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php:153]

1 Cron\CronExpression::setPart called at [/var/app/current/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php:136]

2 Cron\CronExpression::setExpression called at [/var/app/current/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php:115]

3 Cron\CronExpression::__construct called at [/var/app/current/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php:84]

4 Cron\CronExpression::factory called at [/var/app/current/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php:296]

This is the dependency graph: laravel/framework v5.4.36 The Laravel Framework. |--doctrine/inflector ~1.1 | `--php ^7.1 ... |--mtdowling/cron-expression ~1.0 ...

We're a week away from getting off this old version of Laravel so we've locked down the dependency 1.2.1 to solve our issue.

I'm just tossing this up here in case it helps someone else debug this issue.

graceoflives commented 4 years ago

Temporary fix while waiting for changes from Laravel: add this to your composer.json: "mtdowling/cron-expression": "1.2.1"

dragonmantank commented 4 years ago

As a note for anyone stumbling upon this issue:

THIS PACKAGE IS ABANDONED AND SHOULD BE CHANGED TO dragonmantank/cron-expression

This older version of the library stopped development in 2017, and will receive no bug fixes or updates.

The new version of the library has the old tags to make migration easier, so you can continue to use the v1.x code from the new repo as well. It is in your best interest to updated to the newest 2.x+ lines sooner rather than later, as 1.x has multiple resolution logic issues. It will require updating your version of PHP to 7.0 or higher as a consequence though.

As a note, I pushed out v1.2.3 which should reverse this specific issue. I improperly tagged 1.2.2 off of master, which had some changes that turned into the eventual 2.x branch. I'm just waiting on Packagist to notice the v1.2.3 tag. (And no, I cannot set this to auto-update Packagist or mark it abandoned in Packagist, so it just has to wait).

Feel free to either hard-lock on 1.2.1 or wait until 1.2.3 is available via Packagist and re-run composer update.

I cannot stress enough that:

THIS PACKAGE IS ABANDONED AND SHOULD BE CHANGED TO dragonmantank/cron-expression

tfettig commented 4 years ago

@dragonmantank Thank you taking care of this. With the deletion of the 1.2.2 tag nobody else should have the issue. I'm closing this out now.