-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug #77909: DatePeriod::__construct() with invalid recurrence c…
…ount value Improve error message on invalid reccurence count Adding test when reccurence is -1
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 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
19 changes: 19 additions & 0 deletions
19
ext/date/tests/DatePeriod_wrong_recurrence_on_constructor.phpt
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,19 @@ | ||
--TEST-- | ||
DatePeriod: Test wrong recurrence parameter on __construct | ||
--FILE-- | ||
<?php | ||
try { | ||
new DatePeriod(new DateTime('yesterday'), new DateInterval('P1D'), 0); | ||
} catch (Exception $exception) { | ||
echo $exception->getMessage(), "\n"; | ||
} | ||
|
||
try { | ||
new DatePeriod(new DateTime('yesterday'), new DateInterval('P1D'),-1); | ||
} catch (Exception $exception) { | ||
echo $exception->getMessage(), "\n"; | ||
} | ||
?> | ||
--EXPECTF-- | ||
DatePeriod::__construct(): The recurrence count '0' is invalid. Needs to be > 0 | ||
DatePeriod::__construct(): The recurrence count '-1' is invalid. Needs to be > 0 |