[php-src] Issue #18741: timezone_identifiers_list(DateTimeZone::ALL_WITH_BC) Invalid timezones
| From: | blaaat | Date: | Mon, 02 Jun 2025 12:33:51 +0000 |
| Subject: | [php-src] Issue #18741: timezone_identifiers_list(DateTimeZone::ALL_WITH_BC) Invalid timezones | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250196@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/18741
Author: blaaat
### Description
The following code:
```php
<?php
foreach (timezone_identifiers_list(DateTimeZone::ALL_WITH_BC) as $zone) {
$timezone = new DateTimeZone($zone);
}
```
Resulted in this output:
```
PHP Fatal error: Uncaught DateInvalidTimeZoneException: DateTimeZone::__construct(): Unknown or bad
timezone (leapseconds) in /root/a.php:3
Stack trace:
#0 /root/a.php(3): DateTimeZone->__construct('leapseconds')
```
But I expected this output instead:
```
no error
```
my timezone_identifiers_list(DateTimeZone::ALL_WITH_BC) includes invalid timezones:
- leapseconds
- tzdata.zi
On a Rocky9 installation with php installation from remi repo: 8.3.21-1.el9.remi
### PHP Version
```plain
PHP 8.3.21 (cli) (built: May 6 2025 13:58:10) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.3.21, Copyright (c) Zend Technologies
with Zend OPcache v8.3.21, Copyright (c), by Zend Technologies
```
### Operating System
Rocky Linux release 9.5 (Blue Onyx)