[php-src] Issue #8278: DateTime::createFromFormat("Y/m") will create bad date
| From: | cmb69 | Date: | Wed, 30 Mar 2022 12:41:36 +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-240572@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8278
Comment Author: cmb69
If you don't specify the day, the current day is assumed. That is 30, so the second example is
(\DateTime::createFromFormat("Y/m/d",
"2022/02/30"))->format("Y-m-d") and this is supposed to yield
2022-03-02, because February has only 28 days (this year), and so overflow occurs as usual for
ext/date.