mirror of
https://github.com/php/php-src.git
synced 2024-11-25 19:05:31 +08:00
Added support for new method TimeZone::getUnknown() added in ICU 49.
This commit is contained in:
parent
d3a29c108b
commit
69f75bb43c
@ -718,6 +718,9 @@ zend_function_entry intl_functions[] = {
|
|||||||
PHP_FE( intltz_create_default, arginfo_tz_void )
|
PHP_FE( intltz_create_default, arginfo_tz_void )
|
||||||
PHP_FE( intltz_get_id, arginfo_tz_only_tz )
|
PHP_FE( intltz_get_id, arginfo_tz_only_tz )
|
||||||
PHP_FE( intltz_get_gmt, arginfo_tz_void )
|
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_create_enumeration, arginfo_tz_create_enumeration )
|
||||||
PHP_FE( intltz_count_equivalent_ids, arginfo_tz_idarg_static )
|
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 )
|
PHP_FE( intltz_create_time_zone_id_enumeration, arginfo_tz_create_time_zone_id_enumeration )
|
||||||
|
35
ext/intl/tests/timezone_getUnknown_basic.phpt
Normal file
35
ext/intl/tests/timezone_getUnknown_basic.phpt
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
--TEST--
|
||||||
|
IntlCalendar::getUnknown(): basic test
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (!extension_loaded('intl'))
|
||||||
|
die('skip intl extension not enabled');
|
||||||
|
if (version_compare(INTL_ICU_VERSION, '49') < 0)
|
||||||
|
die('skip for ICU 49+');
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
ini_set("intl.error_level", E_WARNING);
|
||||||
|
ini_set("intl.default_locale", "nl");
|
||||||
|
|
||||||
|
$tz = IntlTimeZone::getUnknown();
|
||||||
|
print_r($tz);
|
||||||
|
$tz = intltz_get_unknown();
|
||||||
|
print_r($tz);
|
||||||
|
?>
|
||||||
|
==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==
|
27
ext/intl/tests/timezone_getUnknown_error.phpt
Normal file
27
ext/intl/tests/timezone_getUnknown_error.phpt
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
--TEST--
|
||||||
|
IntlCalendar::getUnknown(): bad arguments
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (!extension_loaded('intl'))
|
||||||
|
die('skip intl extension not enabled');
|
||||||
|
if (version_compare(INTL_ICU_VERSION, '49') < 0)
|
||||||
|
die('skip for ICU 49+');
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
ini_set("intl.error_level", E_WARNING);
|
||||||
|
|
||||||
|
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
|
||||||
|
|
||||||
|
IntlTimeZone::getUnknown(1);
|
||||||
|
|
||||||
|
intltz_get_unknown(1);
|
||||||
|
|
||||||
|
--EXPECTF--
|
||||||
|
|
||||||
|
Warning: IntlTimeZone::getUnknown() expects exactly 0 parameters, 1 given in %s on line %d
|
||||||
|
|
||||||
|
Warning: IntlTimeZone::getUnknown(): intltz_get_unknown: bad arguments in %s on line %d
|
||||||
|
|
||||||
|
Warning: intltz_get_unknown() expects exactly 0 parameters, 1 given in %s on line %d
|
||||||
|
|
||||||
|
Warning: intltz_get_unknown(): intltz_get_unknown: bad arguments in %s on line %d
|
@ -371,6 +371,9 @@ static zend_function_entry TimeZone_class_functions[] = {
|
|||||||
PHP_ME_MAPPING(createTimeZone, intltz_create_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
PHP_ME_MAPPING(createTimeZone, intltz_create_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
||||||
PHP_ME_MAPPING(createDefault, intltz_create_default, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
PHP_ME_MAPPING(createDefault, intltz_create_default, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
||||||
PHP_ME_MAPPING(getGMT, intltz_get_gmt, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
PHP_ME_MAPPING(getGMT, intltz_get_gmt, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
||||||
|
#if U_ICU_VERSION_MAJOR_NUM >= 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(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(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)
|
PHP_ME_MAPPING(createTimeZoneIDEnumeration, intltz_create_time_zone_id_enumeration, ainfo_tz_createTimeZoneIDEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
||||||
|
@ -84,6 +84,20 @@ U_CFUNC PHP_FUNCTION(intltz_get_gmt)
|
|||||||
timezone_object_construct(TimeZone::getGMT(), return_value, 0 TSRMLS_CC);
|
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)
|
U_CFUNC PHP_FUNCTION(intltz_create_enumeration)
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,8 @@ PHP_FUNCTION(intltz_get_id);
|
|||||||
|
|
||||||
PHP_FUNCTION(intltz_get_gmt);
|
PHP_FUNCTION(intltz_get_gmt);
|
||||||
|
|
||||||
|
PHP_FUNCTION(intltz_get_unknown);
|
||||||
|
|
||||||
PHP_FUNCTION(intltz_create_enumeration);
|
PHP_FUNCTION(intltz_create_enumeration);
|
||||||
|
|
||||||
PHP_FUNCTION(intltz_count_equivalent_ids);
|
PHP_FUNCTION(intltz_count_equivalent_ids);
|
||||||
|
Loading…
Reference in New Issue
Block a user