[php-src] Issue #9700: DateTime::createFromFormat with two identical timezones resolves to false
| From: | christoph-kluge | Date: | Mon, 10 Oct 2022 10:10:03 +0000 |
| Subject: | [php-src] Issue #9700: DateTime::createFromFormat with two identical timezones resolves to false | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242558@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9700
Author: christoph-kluge
### Description
Discovered this issue while importing a data-set from a third party.
The following code:
```php
<?php
var_dump(DateTime::createFromFormat('Y-m-d\TH:i:sP[e]',
'2022-02-18T00:00:00+01:00[Europe/Berlin]'));
```
https://3v4l.org/W9SPY
Resulted in this output:
```
bool(false)
```
But I expected this output instead:
```
object(DateTime)#1 (3) {
["date"]=>
string(26) "2022-02-18 00:00:00.000000"
["timezone_type"]=>
int(1)
["timezone"]=>
string(6) "+01:00"
}
```
### PHP Version
8.1.9 (discovered with 7.2.24)
### Operating System
_No response_