ncsuwebdev / otframework

OT Framework for NCSU Zend Applications
5 stars 2 forks source link

ot/cron Schedule cron spec year part confusion #31

Open jamend opened 11 years ago

jamend commented 11 years ago

A standard cron spec does not have a year element, and the code in fromCronString() suggests that it is optional ("if(count($elements = preg_split('/\s+/', $cronSpec)) < 5)", "$newCron->_cronYears = isset($elements[5]) ? "); However omitting the year is not actually supported in the rest of the code where _years is presumed to be set. Perhaps the year part should become mandatory, or the rest of the code should be adjusted to make it optional (which could be done by substituting '*' for the year if it's absent).

jfaustin commented 11 years ago

I agree. The library that does the cron to string conversion was something that we got from another project. It needs a fairly major rewrite and year shouldn't be part of it. The way we solved it for now was to check the string when the class is instantiated, and add an extra * to it before passing it to the parser.