1--TEST--
2IntlTimeZone::toDateTimeZone(): errors
3--SKIPIF--
4<?php
5if (!extension_loaded('intl'))
6    die('skip intl extension not enabled');
7--FILE--
8<?php
9ini_set("intl.error_level", E_WARNING);
10
11$tz = IntlTimeZone::createTimeZone('Etc/Unknown');
12
13try {
14    var_dump($tz->toDateTimeZone());
15} catch (Exception $e) {
16    var_dump($e->getMessage());
17}
18
19var_dump(intltz_to_date_time_zone(1));
20?>
21--EXPECTF--
22Warning: IntlTimeZone::toDateTimeZone(): intltz_to_date_time_zone: DateTimeZone constructor threw exception in %s on line %d
23string(66) "DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)"
24
25Fatal error: Uncaught TypeError: intltz_to_date_time_zone(): Argument #1 ($timezone) must be of type IntlTimeZone, int given in %s:%d
26Stack trace:
27#0 %s(%d): intltz_to_date_time_zone(1)
28#1 {main}
29  thrown in %s on line %d
30