Open
Description
Description
The following code:
<?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
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)