<?php
$start = new DateTime('2011-33-02');
$start->modify('first day of this month');
$end = new DateTime('2012-05-06');
$end->modify('first day of next month');
$interval = DateInterval::createFromDateString('1 month');
$period = new DatePeriod($start, $interval, $end);
foreach ($period as $dt) {
echo $dt->format("Y-m") . PHP_EOL;
}
Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (2011-33-02) at position 6 (3): Unexpected character in /in/caHVt:2
Stack trace:
#0 /in/caHVt(2): DateTime->__construct('2011-33-02')
#1 {main}
thrown in /in/caHVt on line 2
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (2011-33-02) at position 6 (3): Unexpected character in /in/caHVt:2
Stack trace:
#0 /in/caHVt(2): DateTime->__construct('2011-33-02')
#1 {main}
thrown in /in/caHVt on line 2
Process exited with code 255.
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19
Fatal error: Uncaught Exception: Failed to parse time string (2011-33-02) at position 6 (3): Unexpected character in /in/caHVt:2
Stack trace:
#0 /in/caHVt(2): DateTime->__construct('2011-33-02')
#1 {main}
thrown in /in/caHVt on line 2
Process exited with code 255.
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (2011-33-02) at position 6 (3): Unexpected character in /in/caHVt:2
Stack trace:
#0 /in/caHVt(2): DateTime->__construct('2011-33-02')
#1 {main}
thrown in /in/caHVt on line 2
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (2011-33-02) at position 6 (3): Unexpected character' in /in/caHVt:2
Stack trace:
#0 /in/caHVt(2): DateTime->__construct('2011-33-02')
#1 {main}
thrown in /in/caHVt on line 2
Process exited with code 255.