updated cron validation for the case of null, return false

This commit is contained in:
ayntk-ai 2024-08-14 21:54:46 +02:00
parent f93fe75de9
commit f1f6dea04f
No known key found for this signature in database

View File

@ -355,9 +355,17 @@ function isCloud(): bool
function validate_cron_expression($expression_to_validate): bool
{
if ($expression_to_validate === null || $expression_to_validate === '') {
return false;
}
$isValid = false;
$expression = new CronExpression($expression_to_validate);
$isValid = $expression->isValid();
try {
$expression = new CronExpression($expression_to_validate);
$isValid = $expression->isValid();
} catch (\Exception $e) {
return false;
}
if (isset(VALID_CRON_STRINGS[$expression_to_validate])) {
$isValid = true;