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