From 25ed618cf51cac430dac292c16198feee186b0e2 Mon Sep 17 00:00:00 2001 From: Sam Hauglustaine Date: Tue, 10 Dec 2024 17:58:07 +0100 Subject: [PATCH] fix class check --- src/Propel/Runtime/Util/PropelDateTime.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Propel/Runtime/Util/PropelDateTime.php b/src/Propel/Runtime/Util/PropelDateTime.php index 1af002e46..54a9fd3c1 100644 --- a/src/Propel/Runtime/Util/PropelDateTime.php +++ b/src/Propel/Runtime/Util/PropelDateTime.php @@ -79,7 +79,9 @@ protected static function isTimestamp($value): bool */ public static function createHighPrecision(?string $time = null, string $dateTimeClass = 'DateTime'): DateTimeInterface { - if (!is_subclass_of($dateTimeClass, DateTime::class) && !is_subclass_of($dateTimeClass, DateTimeImmutable::class)) { + $allowStringIsA = true; + + if (!is_a($dateTimeClass, DateTime::class, $allowStringIsA) && !is_a($dateTimeClass, DateTimeImmutable::class, $allowStringIsA)) { throw new InvalidArgumentException('`' . $dateTimeClass . '` needs to be an instance of DateTime or DateTimeImmutable'); }