Bug #78590 [NEW]: DatePeriod 0 Recurrences Throws Exception
From: will dot baumbach at iselinc dot com
Operating system: Linux
PHP version: 7.2.22
Package: Date/time related
Bug Type: Bug
Bug description:DatePeriod 0 Recurrences Throws Exception
Description:
------------
---
From manual page: https://php.net/dateperiod.construct
---
As of 7.2.19+, 7.3.6+ and 7.4.0+ the DatePeriod constructor recurrences
argument, no longer accepts 0. Instead an exception is thrown.
This was an undocumented change in the 7.2.19 change log and on the
DatePeriod documentation page.
Fatal error: Uncaught Exception: DatePeriod::__construct(): The
recurrence count '0' is invalid. Needs to be > 0 in /in/vjVTF:6
Stack trace:
#0 /in/vjVTF(6): DatePeriod->__construct(Object(DateTimeImmutable),
Object(DateInterval), 0)
Test script:
---------------
new \DatePeriod(new \DateTimeImmutable(), new \DateInterval('P1D'), 0);
https://3v4l.org/vjVTF
--
Edit bug report at https://bugs.php.net/bug.php?id=78590&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78590&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78590&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78590&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78590&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78590&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78590&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78590&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78590&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78590&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78590&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78590&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78590&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78590&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78590&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78590&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78590&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78590&r=mysqlcfg
Thread (13 messages)
- will dot baumbach at iselinc dot com
- requinix@php.netBug #78590 [Opn->Ver]: DatePeriod 0 Recurrences Throws Exception since 7.2.19
- will dot baumbach at iselinc dot comBug #78590 [Com]: DatePeriod 0 Recurrences Throws Exception since 7.2.19
- requinix@php.netBug #78590 [Ver]: DatePeriod 0 Recurrences Throws Exception since 7.2.19
- will dot baumbach at iselinc dot comBug #78590 [Com]: DatePeriod 0 Recurrences Throws Exception since 7.2.19
- requinix@php.netBug #78590 [Ver->Opn]: DatePeriod 0 Recurrences Throws Exception since 7.2.19
- cmb@php.netBug #78590 [Opn]: DatePeriod 0 Recurrences Throws Exception since 7.2.19
- cmb@php.netBug #78590 [Opn]: DatePeriod 0 Recurrences Throws Exception since 7.2.19
- will dot baumbach at iselinc dot comBug #78590 [Com]: DatePeriod 0 Recurrences Throws Exception since 7.2.19
- sasharobin90 at gmail dot comBug #78590 [Com]: DatePeriod 0 Recurrences Throws Exception since 7.2.19
- cmb@php.netBug #78590 [Asn]: DatePeriod 0 Recurrences Throws Exception since 7.2.19
- ceceliamurphy766 at gmail dot comBug #78590 [Com]: DatePeriod 0 Recurrences Throws Exception since 7.2.19
- barry dot hunter80001 at gmail dot comBug #78590 [Com]: DatePeriod 0 Recurrences Throws Exception since 7.2.19