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 192921c

Browse filesBrowse files
committed
silence PHP warning when an invalid date interval format string is used
1 parent 9adf252 commit 192921c
Copy full SHA for 192921c

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed

‎src/Symfony/Component/Scheduler/Trigger/PeriodicalTrigger.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Scheduler/Trigger/PeriodicalTrigger.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ public function __construct(
5252
$i = $interval;
5353
if (\is_string($interval)) {
5454
$this->description = sprintf('every %s', $interval);
55-
$i = \DateInterval::createFromDateString($interval);
55+
$i = @\DateInterval::createFromDateString($interval);
56+
57+
if (false === $i) {
58+
throw new InvalidArgumentException(sprintf('Invalid interval "%s": ', $interval).error_get_last()['message']);
59+
}
5660
} else {
5761
$a = (array) $interval;
5862
$this->description = \PHP_VERSION_ID >= 80200 && $a['from_string'] ? $a['date_string'] : 'DateInterval';

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.