1--TEST--
2IntlDateFormatter, calendars and time zone
3--INI--
4date.timezone=Atlantic/Azores
5--EXTENSIONS--
6intl
7--SKIPIF--
8<?php if (version_compare(INTL_ICU_VERSION, '54.1') < 0) die('skip for ICU >= 54.1'); ?>
9<?php if (version_compare(INTL_ICU_VERSION, '72.1') >= 0) die('skip for ICU < 72.1'); ?>
10--FILE--
11<?php
12ini_set("intl.error_level", E_WARNING);
13
14$fmt1 = new IntlDateFormatter('en_US',
15    IntlDateFormatter::FULL,
16    IntlDateFormatter::FULL,
17    'GMT+05:12',
18    IntlDateFormatter::TRADITIONAL);
19$fmt2 = new IntlDateFormatter('en_US',
20    IntlDateFormatter::FULL,
21    IntlDateFormatter::FULL,
22    'GMT+05:12',
23    IntlDateFormatter::GREGORIAN);
24$fmt3 = new IntlDateFormatter('en_US@calendar=hebrew',
25    IntlDateFormatter::FULL,
26    IntlDateFormatter::FULL,
27    'GMT+05:12',
28    IntlDateFormatter::TRADITIONAL);
29var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000')));
30var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000')));
31var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000')));
32
33new IntlDateFormatter('en_US@calendar=hebrew',
34    IntlDateFormatter::FULL,
35    IntlDateFormatter::FULL,
36    'GMT+05:12',
37    -1);
38?>
39==DONE==
40--EXPECTF--
41string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12"
42string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12"
43string(44) "Sunday, 6 Tevet 5772 at 5:12:00 AM GMT+05:12"
44
45Fatal error: Uncaught IntlException: 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 %sdateformat_calendars_variant3.php:27
46Stack trace:
47#0 %sdateformat_calendars_variant3.php(%d): IntlDateFormatter->__construct('en_US@calendar=...', 0, 0, 'GMT+05:12', -1)
48#1 {main}
49  thrown %sdateformat_calendars_variant3.php on line %d
50