From 55de927708bc3ce019da330aa9a26a9043b1b748 Mon Sep 17 00:00:00 2001 From: Jon Stovell Date: Mon, 30 Dec 2024 14:18:38 -0700 Subject: [PATCH] Clamps timestamps to accepted range in SMF\Time methods Signed-off-by: Jon Stovell --- Sources/Time.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/Time.php b/Sources/Time.php index 0b028ec262..19cc9012c2 100644 --- a/Sources/Time.php +++ b/Sources/Time.php @@ -196,6 +196,10 @@ public function __construct(string $datetime = 'now', \DateTimeZone|string|null $datetime = self::sanitize($datetime); + if (str_starts_with($datetime, '@')) { + $datetime = '@' . min(max((int) ltrim($datetime, '@'), PHP_INT_MIN), PHP_INT_MAX); + } + if ( // If $datetime was a Unix timestamp, set the time zone to the one // we were told to use. Honestly, it's a mystery why the \DateTime