[php-src] Issue #8652: PHP 8.1 - DateTime::createFromFormat return false
| From: | capsandiego | Date: | Sun, 29 May 2022 19:44:10 +0000 |
| Subject: | [php-src] Issue #8652: PHP 8.1 - DateTime::createFromFormat return false | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241616@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8652
Author: capsandiego
### Description
The following code (which works perfectly in PHP 8.0:
```php
<?php
var_dump(DateTime::createFromFormat('z Y', '147 2022'));
```
Resulted in this output:
```
bool(false)
```
But I expected this output instead:
```
object(DateTime)#2 (3) {
["date"]=>
string(26) "2022-05-28 15:36:32.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "America/New_York"
}
```
The only way to make it work is to swap day of the year and year.
### PHP Version
PHP 8.1.6
### Operating System
Ubuntu Server 18.04