Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3d9788b

Browse files
committed
[RateLimiter] Fix DateInterval normalization
1 parent 97aedb3 commit 3d9788b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Component/RateLimiter/RateLimiterFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ protected static function configureOptions(OptionsResolver $options): void
6969
{
7070
$intervalNormalizer = static function (Options $options, string $interval): \DateInterval {
7171
try {
72-
return (new \DateTimeImmutable())->diff(new \DateTimeImmutable('+'.$interval));
72+
$now = new \DateTimeImmutable();
73+
74+
return $now->diff($now->modify('+'.$interval));
7375
} catch (\Exception $e) {
7476
if (!preg_match('/Failed to parse time string \(\+([^)]+)\)/', $e->getMessage(), $m)) {
7577
throw $e;

0 commit comments

Comments
 (0)