Skip to content

Commit 96b963b

Browse files
committed
fixing locale_lookup() too
1 parent 00e2ee1 commit 96b963b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

ext/intl/locale/locale_methods.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,6 +1438,7 @@ static zend_string* lookup_loc_range(const char* loc_range, HashTable* hash_arr,
14381438

14391439
char **cur_arr = ecalloc(zend_hash_num_elements(hash_arr)*2, sizeof(char *));
14401440
ZEND_HASH_FOREACH_VAL(hash_arr, ele_value) {
1441+
ZVAL_DEREF(ele_value);
14411442
/* convert the array to lowercase , also replace hyphens with the underscore and store it in cur_arr */
14421443
if(Z_TYPE_P(ele_value)!= IS_STRING) {
14431444
/* element value is not a string */

ext/intl/tests/locale_compose_references.phpt renamed to ext/intl/tests/locale_compose_lookup_references.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
locale_compose() with values as references.
2+
locale_compose()/locale_lookup() with values as references.
33
--EXTENSIONS--
44
intl
55
--FILE--
@@ -20,7 +20,10 @@ $data = [
2020
'private2' => 'private2',
2121
];
2222
var_dump(locale_compose($data));
23+
$data = ['de', &$en];
24+
var_dump(locale_lookup($data, "en", false, "en"));
2325
?>
2426
--EXPECT--
2527
string(5) "en_en"
2628
string(36) "de_Hans_DE_en_fr_x_private1_private2"
29+
string(2) "en"

0 commit comments

Comments
 (0)