xref: /PHP-8.0/ext/date/tests/bug51819.phpt (revision ded3d984)
1--TEST--
2Bug #51819 (Case discrepancy in timezone names cause Uncaught exception and fatal error)
3--FILE--
4<?php
5date_default_timezone_set('UTC');
6
7$aTzAbbr = timezone_abbreviations_list();
8
9$aTz = array();
10foreach (array_keys($aTzAbbr) as $sKey) {
11    foreach (array_keys($aTzAbbr[$sKey]) as $iIndex) {
12        $sTz = $aTzAbbr[$sKey][$iIndex]['timezone_id'];
13
14        if (! in_array($sTz, $aTz)) {
15            array_push($aTz, $sTz);
16        }
17    }
18}
19
20foreach ($aTz as $sTz) {
21    $sDate = '2010-05-15 00:00:00 ' . $sTz;
22
23    try {
24        $oDateTime = new DateTime($sDate);
25    } catch (Exception $oException) {
26        var_dump($oException->getMessage());
27        print_r(DateTime::getLastErrors());
28    }
29}
30
31var_dump('this should be the only output');
32?>
33--EXPECT--
34string(30) "this should be the only output"
35