Skip to content

Commit 9a851d6

Browse files
committed
ext/intl: fix locale_compose to able to deal with references.
1 parent 517d7d9 commit 9a851d6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ext/intl/locale/locale_methods.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, char* key_
814814
{
815815
zval *ele_value;
816816

817-
if ((ele_value = zend_hash_str_find(hash_arr , key_name, strlen(key_name))) != NULL ) {
817+
if ((ele_value = zend_hash_str_find_deref(hash_arr , key_name, strlen(key_name))) != NULL ) {
818818
if(Z_TYPE_P(ele_value)!= IS_STRING ){
819819
/* element value is not a string */
820820
return FAILURE;
@@ -857,7 +857,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr,
857857
int isFirstSubtag = 0;
858858

859859
/* Variant/ Extlang/Private etc. */
860-
if ((ele_value = zend_hash_str_find( hash_arr , key_name , strlen(key_name))) != NULL) {
860+
if ((ele_value = zend_hash_str_find_deref( hash_arr , key_name , strlen(key_name))) != NULL) {
861861
if( Z_TYPE_P(ele_value) == IS_STRING ){
862862
add_prefix( loc_name , key_name);
863863

@@ -869,6 +869,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr,
869869
zval *data;
870870

871871
ZEND_HASH_FOREACH_VAL(arr, data) {
872+
ZVAL_DEREF(data);
872873
if(Z_TYPE_P(data) != IS_STRING) {
873874
return FAILURE;
874875
}
@@ -900,7 +901,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr,
900901
isFirstSubtag = 0;
901902
for( i=0 ; i< max_value; i++ ){
902903
snprintf( cur_key_name , 30, "%s%d", key_name , i);
903-
if ((ele_value = zend_hash_str_find( hash_arr , cur_key_name , strlen(cur_key_name))) != NULL) {
904+
if ((ele_value = zend_hash_str_find_deref( hash_arr , cur_key_name , strlen(cur_key_name))) != NULL) {
904905
if( Z_TYPE_P(ele_value)!= IS_STRING ){
905906
/* variant is not a string */
906907
return FAILURE;

0 commit comments

Comments
 (0)