Doc #72461 [Opn->Ver]: Documentation on DatePeriod is missing mention of unbounded periods
| From: | cmb@php.net | Date: | Tue, 21 Jun 2016 11:49:30 +0000 |
| Subject: | Doc #72461 [Opn->Ver]: Documentation on DatePeriod is missing mention of unbounded periods | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13567@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72461&edit=1
ID: 72461
Updated by: cmb@php.net
Reported by: pauld at sagekey dot com
Summary: Documentation on DatePeriod is missing mention of
unbounded periods
-Status: Open
+Status: Verified
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2016-06-20 19:36:39] 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);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72461&edit=1