|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77909 DatePeriod::__construct accept invalid recurrences count
Submitted: 2019-04-16 15:25 UTC Modified: -
From: nyamsprod at gmail dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2019-04-16 15:25 UTC] nyamsprod at gmail dot com
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'),

Expected result:
An exception should be thrown instead an invalid DatePeriod is returned.


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-16 15:27 UTC]
The following pull request has been associated:

Patch Name: Fixed bug #77909: DatePeriod::__construct() with invalid recurrence count value
On GitHub:
 [2019-04-17 08:40 UTC]
Automatic comment on behalf of
Log: Fixed bug #77909: DatePeriod::__construct() with invalid recurrence count value
 [2019-04-17 08:40 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 01 02:03:46 2023 UTC