Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

updated cron validation for the case of null, return false

ayntk-aif1f6dea04ff5
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index aae4fafd4e..6e0f6dd354 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -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;