[php-src] Issue #11854: 8.2.9 DateTime:createFromFormat stopped parsing datetime with containing extra space.
| From: | mn7z | Date: | Wed, 02 Aug 2023 09:29:03 +0000 |
| Subject: | [php-src] Issue #11854: 8.2.9 DateTime:createFromFormat stopped parsing datetime with containing extra space. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245085@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11854
Author: mn7z
### Description
Starting of 8.2.9 version
\DateTime:createFromFormat() starts to fail to parse date
format, due extra space.
The date string Wed Aug 2 08:37:50 2023 - with extra space between Aug
and 2. If extra space is removed
then it works as usual.
PHP versions <8.2.9 correctly parses the format, I've tested with 8.2.7 version in addition
to 8.2.8.
The following code:
```php
<?php
$dateTime = \DateTime::createFromFormat("D M d H:i:s Y", "Wed Aug 2 08:37:50
2023");
var_dump($dateTime);
```
Resulted in this output:
```
bool(false)
```
But I expected this output instead:
```
object(DateTime)#1 (3) {
["date"]=>
string(26) "2023-08-02 08:37:50.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
```
### PHP Version
PHP 8.2.9
### Operating System
_No response_