Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3d9788b

Browse filesBrowse files
committed
[RateLimiter] Fix DateInterval normalization
1 parent 97aedb3 commit 3d9788b
Copy full SHA for 3d9788b

File tree

1 file changed

+3
-1
lines changed
Filter options

1 file changed

+3
-1
lines changed

‎src/Symfony/Component/RateLimiter/RateLimiterFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/RateLimiter/RateLimiterFactory.php
+3-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.