Doc #72461 [Ver->Csd]: Documentation on DatePeriod is missing mention of unbounded periods

From: Date: Tue, 21 Jun 2016 11:59:15 +0000
Subject: Doc #72461 [Ver->Csd]: Documentation on DatePeriod is missing mention of unbounded periods
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13568@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: Verified +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant Assigned To: cmb Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2016-06-21 11:58:52] 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:49:27] 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-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

« previous php.doc.bugs (#13568) next »