php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #72461 Documentation on DatePeriod is missing mention of unbounded periods
Submitted: 2016-06-20 19:36 UTC Modified: 2016-06-21 11:59 UTC
From: pauld at sagekey dot com Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2016-06-20 19:36 UTC] pauld at sagekey dot com
Description:
------------
---
From manual page: http://www.php.net/class.dateperiod
---

DatePeriod does not appear to support ISO 8601 date periods without an upper bound (e.g., 'R/2016-16-20T00:00:00Z/P7D') or null end dates. The ISO spec itself supports this, so a note should be made in the documentation that DatePeriod does not.

Test script:
---------------
// This throws an exception with message 'DatePeriod::__construct(): Unknown or bad format (R/2016-06-20T00:00:00Z/P7D)'
$dp1 = new DatePeriod('R/2016-06-20T00:00:00Z/P7D');

// This silently accepts the null third argument; the resulting object has a null end date and one recurrence.
$dp = new DatePeriod(new DateTime('2016-06-20'), new DateInterval('P7D'), null);


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-21 11:49 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2016-06-21 11:49 UTC] cmb@php.net
Indeed, unbound periods are apparently unsupported.

To clarify: if `null` is passed as third argument it is juggled to
0, and is interpreted as $recurrences (not as $end), i.e. the
first form of the constructor is used.
 [2016-06-21 11:58 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=339435
Log: Fix #72461: Documentation on DatePeriod is missing mention of unbounded periods
 [2016-06-21 11:59 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2016-06-21 11:59 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-02-07 06:07 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=707cc32e4b404cf96fc8060ddc14cf876bca8c94
Log: Fix #72461: Documentation on DatePeriod is missing mention of unbounded periods
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 06:00:01 2026 UTC