1--TEST-- 2IntlCalendar::fromDateTime(): errors 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("intl.default_locale", "nl"); 11date_default_timezone_set('Europe/Lisbon'); 12 13var_dump(IntlCalendar::fromDateTime()); 14var_dump(IntlCalendar::fromDateTime(0,1,2)); 15 16try { 17IntlCalendar::fromDateTime("foobar"); 18} catch (Exception $e) { 19 echo "threw exception, OK"; 20} 21class A extends DateTime { 22function __construct() {} 23} 24 25var_dump(IntlCalendar::fromDateTime(new A)); 26 27$date = new DateTime('2012-01-01 00:00:00 +24:00'); 28var_dump(IntlCalendar::fromDateTime($date)); 29 30$date = new DateTime('2012-01-01 00:00:00 WEST'); 31var_dump(IntlCalendar::fromDateTime($date)); 32 33var_dump(intlcal_from_date_time()); 34 35--EXPECTF-- 36 37Warning: IntlCalendar::fromDateTime() expects at least 1 parameter, 0 given in %s on line %d 38 39Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad arguments in %s on line %d 40NULL 41 42Warning: IntlCalendar::fromDateTime() expects at most 2 parameters, 3 given in %s on line %d 43 44Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad arguments in %s on line %d 45NULL 46threw exception, OK 47Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: DateTime object is unconstructed in %s on line %d 48NULL 49 50Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: object has an time zone offset that's too large in %s on line %d 51NULL 52 53Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d 54NULL 55 56Warning: intlcal_from_date_time() expects at least 1 parameter, 0 given in %s on line %d 57 58Warning: intlcal_from_date_time(): intlcal_from_date_time: bad arguments in %s on line %d 59NULL 60