-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-14709 overflow on recurrences for DatePeriod::__construct
- Loading branch information
Showing
4 changed files
with
44 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--TEST-- | ||
Bug GH-14709 overflow on reccurences parameter | ||
--FILE-- | ||
<?php | ||
$start = new DateTime('2018-12-31 00:00:00'); | ||
$interval = new DateInterval('P1M'); | ||
|
||
try { | ||
new DatePeriod($start, $interval, 2147483640); | ||
} catch (Exception $e) { | ||
echo $e->getMessage() . PHP_EOL; | ||
} | ||
|
||
try { | ||
new DatePeriod($start, $interval, 2147483639, DatePeriod::EXCLUDE_START_DATE | DatePeriod::INCLUDE_END_DATE); | ||
} catch (Exception $e) { | ||
echo $e->getMessage(); | ||
} | ||
?> | ||
--EXPECTF-- | ||
DatePeriod::__construct(): Recurrence count must be greater or equal to 1 and lower than %d | ||
DatePeriod::__construct(): Recurrence count must be greater or equal to 1 and lower than %d (including options) |