Bug #77909 [Opn->Csd]: DatePeriod::__construct accept invalid recurrences count
| From: | derick@php.net | Date: | Wed, 17 Apr 2019 08:40:49 +0000 |
| Subject: | Bug #77909 [Opn->Csd]: DatePeriod::__construct accept invalid recurrences count | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220504@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77909&edit=1
ID: 77909
Updated by: derick@php.net
Reported by: nyamsprod at gmail dot com
Summary: DatePeriod::__construct accept invalid recurrences
count
-Status: Open
+Status: Closed
Type: Bug
Package: Date/time related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nyamsprod@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7b1a4e24008f34a76c343ece735953ad5124e09f
Log: Fixed bug #77909: DatePeriod::__construct() with invalid recurrence count value
Previous Comments:
------------------------------------------------------------------------
[2019-04-16 15:27:37]
The following pull request has been associated:
Patch Name: Fixed bug #77909: DatePeriod::__construct() with invalid recurrence count value
On GitHub: https://github.com/php/php-src/pull/3987
Patch: https://github.com/php/php-src/pull/3987.patch
------------------------------------------------------------------------
[2019-04-16 15:25:15] nyamsprod at gmail dot com
Description:
------------
Currently when instantiating a DatePeriod object with the ISO Interval notation an exception is
thrown if the recurrence count value is lesser than 1.
But when using the alternate constructor no exception is thrown. This lead to the recurrence count
being lesser than 1 which should not be possible.
Test script:
---------------
$date = new DatePeriod(
new DateTime('2012-07-01T00:00:00Z'),
new DateInterval('P7D'),
0
);
Expected result:
----------------
An exception should be thrown instead an invalid DatePeriod is returned.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77909&edit=1