|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: nyamsprod at gmail dot com
New email:
PHP Version: OS:


 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 07:01:29 2024 UTC