1--TEST-- 2IntlCalendar::toDateTime(): bad arguments 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('date.timezone', 'Europe/Lisbon'); 11 12$cal = new IntlGregorianCalendar(); 13var_dump($cal->toDateTime(3)); 14 15var_dump(intlcal_to_date_time($cal, 3)); 16 17$cal = new IntlGregorianCalendar("Etc/Unknown"); 18try { 19var_dump($cal->toDateTime()); 20} catch (Exception $e) { 21var_dump("exception: {$e->getMessage()}"); 22} 23 24var_dump(intlcal_to_date_time(3)); 25--EXPECTF-- 26Warning: IntlCalendar::toDateTime() expects exactly 0 parameters, 1 given in %s on line %d 27 28Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: bad arguments in %s on line %d 29bool(false) 30 31Warning: intlcal_to_date_time() expects exactly 1 parameter, 2 given in %s on line %d 32 33Warning: intlcal_to_date_time(): intlcal_to_date_time: bad arguments in %s on line %d 34bool(false) 35 36Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: DateTimeZone constructor threw exception in %s on line %d 37string(77) "exception: DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)" 38 39Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_to_date_time() must be an instance of IntlCalendar, int given in %s:%d 40Stack trace: 41#0 %s(%d): intlcal_to_date_time(3) 42#1 {main} 43 thrown in %s on line %d 44