dragonmantank / cron-expression

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
MIT License
4.55k stars 121 forks source link

Invalid cron expression causes memory overflow #156

Closed DKhalil closed 1 year ago

DKhalil commented 1 year ago

The particular expression in our case was this:

$cron = new \Cron\CronExpression('0 0 - 2,5,8,11 ?');

Just creating a new CronExpression object will cause an endless loop and run out of memory at some point.

Tested with v3.3.2

dragonmantank commented 1 year ago

Can you let me know what PHP version and OS you are using? That cron expression should immediately bail out with:

InvalidArgumentException: Invalid CRON field value - at position 2
DKhalil commented 1 year ago

After trying it out now with 3.3.3 that is what happens, yes. Thanks!