Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/intl/locale/locale.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
21 changes: 16 additions & 5 deletions ext/intl/locale/locale_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)){
Expand Down