1--TEST--
2IntlCalendar::toDateTime(): bad arguments
3--EXTENSIONS--
4intl
5--FILE--
6<?php
7ini_set("intl.error_level", E_WARNING);
8ini_set('date.timezone', 'Europe/Lisbon');
9
10$cal = new IntlGregorianCalendar("Etc/Unknown");
11try {
12var_dump($cal->toDateTime());
13} catch (Exception $e) {
14var_dump("exception: {$e->getMessage()}");
15}
16
17try {
18    var_dump(intlcal_to_date_time($cal));
19} catch (\Exception $e) {
20    var_dump($e->getMessage());
21}
22
23$cal = IntlCalendar::createInstance("Etc/Unknown");
24try {
25    var_dump($cal->toDateTime());
26} catch (\Exception $e) {
27    var_dump($e->getMessage());
28}
29
30try {
31    var_dump(intlcal_to_date_time($cal));
32} catch (\Exception $e) {
33    var_dump($e->getMessage());
34}
35
36try {
37    var_dump(intlcal_to_date_time(3));
38} catch (\TypeError $e) {
39    echo $e->getMessage() . \PHP_EOL;
40}
41?>
42--EXPECTF--
43Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: DateTimeZone constructor threw exception in %s on line %d
44string(77) "exception: DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)"
45
46Warning: intlcal_to_date_time(): intlcal_to_date_time: DateTimeZone constructor threw exception in %s on line %d
47string(66) "DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)"
48
49Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: DateTimeZone constructor threw exception in %s on line %d
50string(66) "DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)"
51
52Warning: intlcal_to_date_time(): intlcal_to_date_time: DateTimeZone constructor threw exception in %s on line %d
53string(66) "DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)"
54intlcal_to_date_time(): Argument #1 ($calendar) must be of type IntlCalendar, int given
55