Convert: do not block if the $error is a boolean

This commit is contained in:
2022-12-13 14:40:05 +01:00
parent 6ac1889e35
commit d5c5806767

View File

@@ -60,7 +60,12 @@ class Convert
return $inputDate; return $inputDate;
} }
$errors = $date->getLastErrors(); $errors = $date->getLastErrors();
if ($errors["warning_count"] > 0 || $errors["error_count"] > 0) { if (
$errors !== false && (
$errors["warning_count"] > 0 ||
$errors["error_count"] > 0
)
) {
if ($exception === true) { if ($exception === true) {
throw new \Exception( throw new \Exception(
"Invalid date provided or not matching the format", "Invalid date provided or not matching the format",