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 26--EXPECTF-- 27 28Warning: IntlCalendar::toDateTime() expects exactly 0 parameters, 1 given in %s on line %d 29 30Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: bad arguments in %s on line %d 31bool(false) 32 33Warning: intlcal_to_date_time() expects exactly 1 parameter, 2 given in %s on line %d 34 35Warning: intlcal_to_date_time(): intlcal_to_date_time: bad arguments in %s on line %d 36bool(false) 37 38Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: DateTimeZone constructor threw exception in %s on line %d 39string(77) "exception: DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)" 40 41Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_to_date_time() must be an instance of IntlCalendar, integer given in %s:%d 42Stack trace: 43#0 %s(%d): intlcal_to_date_time(3) 44#1 {main} 45 thrown in %s on line %d 46