1--TEST--
2IntlDateFormatter::__construct(): bad timezone or calendar
3--EXTENSIONS--
4intl
5--FILE--
6<?php
7ini_set("intl.error_level", E_WARNING);
8ini_set("intl.default_locale", "pt_PT");
9ini_set("date.timezone", 'Atlantic/Azores');
10
11function print_exception($e) {
12    echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
13}
14
15try {
16    var_dump(new IntlDateFormatter(NULL, 0, 0, 'bad timezone'));
17} catch (IntlException $e) {
18    print_exception($e);
19}
20try {
21    var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, 3));
22} catch (IntlException $e) {
23    print_exception($e);
24}
25try {
26    var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, new stdclass));
27} catch (TypeError $e) {
28    print_exception($e);
29}
30?>
31--EXPECTF--
32Exception: IntlDateFormatter::__construct(): datefmt_create: No such time zone: 'bad timezone' in %s on line %d
33
34Exception: IntlDateFormatter::__construct(): datefmt_create: Invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %s on line %d
35
36Exception: IntlDateFormatter::__construct(): Argument #5 ($calendar) must be of type IntlCalendar|int|null, stdClass given in %s on line %d
37