diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 95045551cef..bc67443c54b 100755 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -718,6 +718,9 @@ zend_function_entry intl_functions[] = { PHP_FE( intltz_create_default, arginfo_tz_void ) PHP_FE( intltz_get_id, arginfo_tz_only_tz ) PHP_FE( intltz_get_gmt, arginfo_tz_void ) +#if U_ICU_VERSION_MAJOR_NUM >= 49 + PHP_FE( intltz_get_unknown, arginfo_tz_void ) +#endif PHP_FE( intltz_create_enumeration, arginfo_tz_create_enumeration ) PHP_FE( intltz_count_equivalent_ids, arginfo_tz_idarg_static ) PHP_FE( intltz_create_time_zone_id_enumeration, arginfo_tz_create_time_zone_id_enumeration ) diff --git a/ext/intl/tests/timezone_getUnknown_basic.phpt b/ext/intl/tests/timezone_getUnknown_basic.phpt new file mode 100644 index 00000000000..aef1a54561c --- /dev/null +++ b/ext/intl/tests/timezone_getUnknown_basic.phpt @@ -0,0 +1,35 @@ +--TEST-- +IntlCalendar::getUnknown(): basic test +--SKIPIF-- + +==DONE== +--EXPECT-- +IntlTimeZone Object +( + [valid] => 1 + [id] => Etc/Unknown + [rawOffset] => 0 + [currentOffset] => 0 +) +IntlTimeZone Object +( + [valid] => 1 + [id] => Etc/Unknown + [rawOffset] => 0 + [currentOffset] => 0 +) +==DONE== \ No newline at end of file diff --git a/ext/intl/tests/timezone_getUnknown_error.phpt b/ext/intl/tests/timezone_getUnknown_error.phpt new file mode 100644 index 00000000000..4aec28f8067 --- /dev/null +++ b/ext/intl/tests/timezone_getUnknown_error.phpt @@ -0,0 +1,27 @@ +--TEST-- +IntlCalendar::getUnknown(): bad arguments +--SKIPIF-- += 49 + PHP_ME_MAPPING(getUnknown, intltz_get_unknown, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) +#endif PHP_ME_MAPPING(createEnumeration, intltz_create_enumeration, ainfo_tz_createEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME_MAPPING(countEquivalentIDs, intltz_count_equivalent_ids, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME_MAPPING(createTimeZoneIDEnumeration, intltz_create_time_zone_id_enumeration, ainfo_tz_createTimeZoneIDEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index a6de82de24c..37b39967069 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -84,6 +84,20 @@ U_CFUNC PHP_FUNCTION(intltz_get_gmt) timezone_object_construct(TimeZone::getGMT(), return_value, 0 TSRMLS_CC); } +#if U_ICU_VERSION_MAJOR_NUM >= 49 +U_CFUNC PHP_FUNCTION(intltz_get_unknown) +{ + intl_error_reset(NULL TSRMLS_CC); + + if (zend_parse_parameters_none() == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intltz_get_unknown: bad arguments", 0 TSRMLS_CC); + RETURN_NULL(); + } + + timezone_object_construct(&TimeZone::getUnknown(), return_value, 0 TSRMLS_CC); +} +#endif U_CFUNC PHP_FUNCTION(intltz_create_enumeration) { diff --git a/ext/intl/timezone/timezone_methods.h b/ext/intl/timezone/timezone_methods.h index b16881209b7..207caa3cb06 100644 --- a/ext/intl/timezone/timezone_methods.h +++ b/ext/intl/timezone/timezone_methods.h @@ -27,6 +27,8 @@ PHP_FUNCTION(intltz_get_id); PHP_FUNCTION(intltz_get_gmt); +PHP_FUNCTION(intltz_get_unknown); + PHP_FUNCTION(intltz_create_enumeration); PHP_FUNCTION(intltz_count_equivalent_ids);