1--TEST--
2IntlDateFormatter::__construct(): bad timezone or calendar
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);
10ini_set("intl.default_locale", "pt_PT");
11ini_set("date.timezone", 'Atlantic/Azores');
12
13function print_exception($e) {
14    echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
15}
16
17try {
18    var_dump(new IntlDateFormatter(NULL, 0, 0, 'bad timezone'));
19} catch (IntlException $e) {
20    print_exception($e);
21}
22try {
23    var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, 3));
24} catch (IntlException $e) {
25    print_exception($e);
26}
27try {
28    var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, new stdclass));
29} catch (TypeError $e) {
30    print_exception($e);
31}
32?>
33--EXPECTF--
34Exception: IntlDateFormatter::__construct(): datefmt_create: No such time zone: 'bad timezone' in %s on line %d
35
36Exception: 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
37
38Exception: IntlDateFormatter::__construct(): Argument #5 ($calendar) must be of type IntlCalendar|int|null, stdClass given in %s on line %d
39