[php-src] Issue #8278: DateTime::createFromFormat("Y/m") will create bad date

From: Date: Wed, 30 Mar 2022 12:21:17 +0000
Subject: [php-src] Issue #8278: DateTime::createFromFormat("Y/m") will create bad date
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-240570@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8278 Author: sousekmfcc ### Description The following code: ```php <?php echo "January: " . (\DateTime::createFromFormat("Y/m", "2022/01"))->format("Y-m-d") . PHP_EOL; echo "February: " . (\DateTime::createFromFormat("Y/m", "2022/02"))->format("Y-m-d") . PHP_EOL; echo "April: " . (\DateTime::createFromFormat("Y/m", "2022/04"))->format("Y-m-d"); ``` Resulted in this output: ``` January: 2022-01-30 February: 2022-03-02 April: 2022-04-30 ``` But I expected this output instead: ``` January: 2022-01-31 February: 2022-02-28 April: 2022-04-30 ``` ### PHP Version PHP 7.4 - PHP 8.0 ### Operating System _No response_

« previous php.bugs (#240570) next »