[php-src] Issue #10287: DateTimeZone::listIdentifiers returns a timezone Etc/GMT+0 which can not be used by DateTimeZone constructor
| From: | fuzin | Date: | Wed, 11 Jan 2023 09:48:02 +0000 |
| Subject: | [php-src] Issue #10287: DateTimeZone::listIdentifiers returns a timezone Etc/GMT+0 which can not be used by DateTimeZone constructor | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243404@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10287
Author: fuzin
### Description
The following code:
```php
<?php
$timezoneIdentifiers = \DateTimeZone::listIdentifiers(\DateTimeZone::ALL_WITH_BC);
foreach($timezoneIdentifiers as $timezoneIdentifier) {
(new \DateTimeZone($timezoneIdentifier));
}
```
Resulted in this output:
```
PHP Fatal error: Uncaught Exception: DateTimeZone::__construct(): Unknown or bad timezone
(Etc/GMT+0)
```
But I expecte if DateTimeZone::getIdentifiers retuns a timezone it is also possible to use it in
constructor.
It is working fine in PHP 8.2.0.
### PHP Version
PHP 8.2.1
### Operating System
php:8.2-fpm-alpine