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 13try { 14 IntlCalendar::fromDateTime("foobar"); 15} catch (Exception $e) { 16 echo "threw exception, OK"; 17} 18class A extends DateTime { 19function __construct() {} 20} 21 22var_dump(IntlCalendar::fromDateTime(new A)); 23 24$date = new DateTime('2012-01-01 00:00:00 +24:00'); 25var_dump(IntlCalendar::fromDateTime($date)); 26 27$date = new DateTime('2012-01-01 00:00:00 WEST'); 28var_dump(IntlCalendar::fromDateTime($date)); 29?> 30--EXPECTF-- 31threw exception, OK 32Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: DateTime object is unconstructed in %s on line %d 33NULL 34 35Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: object has an time zone offset that's too large in %s on line %d 36NULL 37 38Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d 39NULL 40