From d5c58067678b6bf9ef78e383b7d07f3022df2c11 Mon Sep 17 00:00:00 2001 From: Dominique FOURNIER Date: Tue, 13 Dec 2022 14:40:05 +0100 Subject: [PATCH] Convert: do not block if the $error is a boolean --- src/Convert.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Convert.php b/src/Convert.php index 24e2d43..8197fbb 100644 --- a/src/Convert.php +++ b/src/Convert.php @@ -60,7 +60,12 @@ class Convert return $inputDate; } $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) { throw new \Exception( "Invalid date provided or not matching the format",