Skip to content

Commit

Permalink
Clamps timestamps to accepted range in SMF\Time methods
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Stovell <[email protected]>
  • Loading branch information
Sesquipedalian committed Dec 30, 2024
1 parent 5a0150e commit 55de927
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 55de927

Please sign in to comment.