[php-src] Issue #9859: DateTime::createFromFormat will return wrong month

From: Date: Mon, 31 Oct 2022 08:55:18 +0000
Subject: [php-src] Issue #9859: DateTime::createFromFormat will return wrong month
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242713@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9859 Author: Knallcharge ### Description The following code: ```php <?php echo \DateTime::createFromFormat('m.Y', '11.2017')->format('Y-m'); ``` Resulted in this output: ``` 2017-12 ``` But I expected this output instead: ``` 2017-11 ``` Additional information: The above code is part of a unit test which never failed until today (October 31st) while neither the unit test nor the tested code changed. It seems like DateTime is mixing up 30/31 days in a month and switching to the next month when the current date is the last day of the month? Using "10.2017" as input will produce "2017-10" and "12.2017" will show "2017-12" as output, just as expected. ### PHP Version PHP 8.1.12 ### Operating System Windows 10, Windows Server 2012

« previous php.bugs (#242713) next »