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