diff --git a/ext/intl/locale/locale.h b/ext/intl/locale/locale.h index 31aef035050d1..0dcd2c89e50a6 100644 --- a/ext/intl/locale/locale.h +++ b/ext/intl/locale/locale.h @@ -26,6 +26,7 @@ #define LOC_GRANDFATHERED_LANG_TAG "grandfathered" #define LOC_PRIVATE_TAG "private" #define LOC_CANONICALIZE_TAG "canonicalize" +#define LOC_TIMEZONE "timezone" #define LOCALE_INI_NAME "intl.default_locale" diff --git a/ext/intl/locale/locale_methods.cpp b/ext/intl/locale/locale_methods.cpp index 5cf6928a8cd3c..baf3670b3f26a 100644 --- a/ext/intl/locale/locale_methods.cpp +++ b/ext/intl/locale/locale_methods.cpp @@ -810,12 +810,17 @@ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, const char /* element value is not a string */ return FAILURE; } - if(strcmp(key_name, LOC_LANG_TAG) != 0 && - strcmp(key_name, LOC_GRANDFATHERED_LANG_TAG)!=0 ) { - /* not lang or grandfathered tag */ - smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); + if(strcmp(key_name, LOC_TIMEZONE) != 0) { + if(strcmp(key_name, LOC_LANG_TAG) != 0 && + strcmp(key_name, LOC_GRANDFATHERED_LANG_TAG)!=0) { + /* not lang or grandfathered tag */ + smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); + } + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); + } else { + smart_str_appends(loc_name, "@timezone="); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value), Z_STRLEN_P(ele_value)); } - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); return SUCCESS; } @@ -991,6 +996,12 @@ U_CFUNC PHP_FUNCTION(locale_compose) RETURN_FALSE; } + /* Timezone */ + result = append_key_value( loc_name, hash_arr , LOC_TIMEZONE); + if( !handleAppendResult( result, loc_name)){ + RETURN_FALSE; + } + /* Variant */ result = append_multiple_key_values( loc_name, hash_arr , LOC_VARIANT_TAG); if( !handleAppendResult( result, loc_name)){