From d621864157a9d695767f3630fabc3608b5d50242 Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Tue, 16 Jul 2019 14:17:03 +0200 Subject: [PATCH] Fix DateTimePacker not catching invalid date/times --- src/ObjectPacker/DateTimePacker.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ObjectPacker/DateTimePacker.php b/src/ObjectPacker/DateTimePacker.php index ea4c395..edf0aa3 100644 --- a/src/ObjectPacker/DateTimePacker.php +++ b/src/ObjectPacker/DateTimePacker.php @@ -4,11 +4,11 @@ namespace Brick\App\ObjectPacker; +use Brick\DateTime\DateTimeException; use Brick\DateTime\Duration; use Brick\DateTime\LocalDate; use Brick\DateTime\LocalDateTime; use Brick\DateTime\LocalTime; -use Brick\DateTime\Parser\DateTimeParseException; use Brick\DateTime\TimeZoneOffset; use Brick\DateTime\TimeZoneRegion; use Brick\DateTime\YearMonth; @@ -93,7 +93,7 @@ public function unpack(PackedObject $packedObject) case ZonedDateTime::class: return ZonedDateTime::parse($data); } - } catch (DateTimeParseException $e) { + } catch (DateTimeException $e) { throw new Exception\ObjectNotConvertibleException($e->getMessage(), 0, $e); }