1--TEST--
2IntlCalendar::fieldDifference(): bad arguments
3--INI--
4date.timezone=Atlantic/Azores
5--SKIPIF--
6<?php
7if (!extension_loaded('intl'))
8    die('skip intl extension not enabled');
9--FILE--
10<?php
11ini_set("intl.error_level", E_WARNING);
12
13$c = new IntlGregorianCalendar(NULL, 'pt_PT');
14
15try {
16    var_dump($c->fieldDifference($c, 2, 3));
17} catch (TypeError $e) {
18    echo $e->getMessage(), "\n";
19}
20var_dump($c->fieldDifference(INF, 2));
21
22try {
23    var_dump(intlcal_field_difference($c, 0, 1, 2));
24} catch (TypeError $e) {
25    echo $e->getMessage(), "\n";
26}
27var_dump(intlcal_field_difference(1, 0, 1));
28?>
29--EXPECTF--
30IntlCalendar::fieldDifference() expects exactly 2 arguments, 3 given
31
32Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: Call to ICU method has failed in %s on line %d
33bool(false)
34intlcal_field_difference() expects exactly 3 arguments, 4 given
35
36Fatal error: Uncaught TypeError: intlcal_field_difference(): Argument #1 ($calendar) must be of type IntlCalendar, int given in %s:%d
37Stack trace:
38#0 %s(%d): intlcal_field_difference(1, 0, 1)
39#1 {main}
40  thrown in %s on line %d
41