[php-src] Issue #10286: new DateTimeZone('Etc/GMT+9') fails with fatal error since 8.1.14
| From: | nicolas-grekas | Date: | Wed, 11 Jan 2023 09:18:04 +0000 |
| Subject: | [php-src] Issue #10286: new DateTimeZone('Etc/GMT+9') fails with fatal error since 8.1.14 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243402@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10286
Author: nicolas-grekas
### Description
The following code (see https://3v4l.org/lfalF):
```php
var_dump(date_default_timezone_set('Etc/GMT+9'));
$d = new DateTime();
var_dump($d->getTimeZone());
new DateTimeZone('Etc/GMT+9');
```
Resulted in this output:
```
Fatal error: Uncaught Exception: DateTimeZone::__construct(): Unknown or bad timezone (Etc/GMT+9)
```
But I expected this output instead:
```
no error
```
As highlighted by the code sample, it's possible to create such a DateTimeZone object via
DateTime::getTimeZone.
### PHP Version
PHP 8.1.14+
### Operating System
_No response_