From 2675ceaf9cb83b335ea6947ebc071109d030393f Mon Sep 17 00:00:00 2001 From: KyleKatarn Date: Wed, 9 Aug 2023 20:20:02 +0200 Subject: [PATCH] Disallow 5-digits years in `hasFormat()` Fix #2831 --- src/Carbon/Traits/Options.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Carbon/Traits/Options.php b/src/Carbon/Traits/Options.php index 48f9739773..2b0fc23593 100644 --- a/src/Carbon/Traits/Options.php +++ b/src/Carbon/Traits/Options.php @@ -80,9 +80,9 @@ trait Options 'n' => '(1[012]|[1-9])', 't' => '(2[89]|3[01])', 'L' => '(0|1)', - 'o' => '([1-9][0-9]{0,4})', - 'Y' => '([1-9]?[0-9]{4})', - 'y' => '([0-9]{2})', + 'o' => '([0-9]{1,4})', + 'Y' => '([0-9]{1,4})', + 'y' => '([0-9]{1,2})', 'a' => '(am|pm)', 'A' => '(AM|PM)', 'B' => '([0-9]{3})',