mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
This commit is contained in:
@@ -807,7 +807,7 @@ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, char* key_
|
||||
{
|
||||
zval *ele_value;
|
||||
|
||||
if ((ele_value = zend_hash_str_find(hash_arr , key_name, strlen(key_name))) != NULL ) {
|
||||
if ((ele_value = zend_hash_str_find_deref(hash_arr , key_name, strlen(key_name))) != NULL ) {
|
||||
if(Z_TYPE_P(ele_value)!= IS_STRING ){
|
||||
/* element value is not a string */
|
||||
return FAILURE;
|
||||
@@ -850,7 +850,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr,
|
||||
int isFirstSubtag = 0;
|
||||
|
||||
/* Variant/ Extlang/Private etc. */
|
||||
if ((ele_value = zend_hash_str_find( hash_arr , key_name , strlen(key_name))) != NULL) {
|
||||
if ((ele_value = zend_hash_str_find_deref( hash_arr , key_name , strlen(key_name))) != NULL) {
|
||||
if( Z_TYPE_P(ele_value) == IS_STRING ){
|
||||
add_prefix( loc_name , key_name);
|
||||
|
||||
@@ -862,6 +862,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr,
|
||||
zval *data;
|
||||
|
||||
ZEND_HASH_FOREACH_VAL(arr, data) {
|
||||
ZVAL_DEREF(data);
|
||||
if(Z_TYPE_P(data) != IS_STRING) {
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -893,7 +894,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr,
|
||||
isFirstSubtag = 0;
|
||||
for( i=0 ; i< max_value; i++ ){
|
||||
snprintf( cur_key_name , 30, "%s%d", key_name , i);
|
||||
if ((ele_value = zend_hash_str_find( hash_arr , cur_key_name , strlen(cur_key_name))) != NULL) {
|
||||
if ((ele_value = zend_hash_str_find_deref( hash_arr , cur_key_name , strlen(cur_key_name))) != NULL) {
|
||||
if( Z_TYPE_P(ele_value)!= IS_STRING ){
|
||||
/* variant is not a string */
|
||||
return FAILURE;
|
||||
@@ -1426,6 +1427,7 @@ static zend_string* lookup_loc_range(const char* loc_range, HashTable* hash_arr,
|
||||
|
||||
char **cur_arr = ecalloc(zend_hash_num_elements(hash_arr)*2, sizeof(char *));
|
||||
ZEND_HASH_FOREACH_VAL(hash_arr, ele_value) {
|
||||
ZVAL_DEREF(ele_value);
|
||||
/* convert the array to lowercase , also replace hyphens with the underscore and store it in cur_arr */
|
||||
if(Z_TYPE_P(ele_value)!= IS_STRING) {
|
||||
/* element value is not a string */
|
||||
|
||||
29
ext/intl/tests/locale_compose_lookup_references.phpt
Normal file
29
ext/intl/tests/locale_compose_lookup_references.phpt
Normal file
@@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
locale_compose()/locale_lookup() with values as references.
|
||||
--EXTENSIONS--
|
||||
intl
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$en = 'en';
|
||||
$data = [Locale::LANG_TAG => 'en', Locale::REGION_TAG => &$en];
|
||||
|
||||
var_dump(locale_compose($data));
|
||||
|
||||
$data = [
|
||||
'language' => 'de',
|
||||
'script' => 'Hans',
|
||||
'region' => 'DE',
|
||||
'variant2' => 'fr',
|
||||
'variant1' => &$en,
|
||||
'private1' => 'private1',
|
||||
'private2' => 'private2',
|
||||
];
|
||||
var_dump(locale_compose($data));
|
||||
$data = ['de', &$en];
|
||||
var_dump(locale_lookup($data, "en", false, "en"));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(5) "en_en"
|
||||
string(36) "de_Hans_DE_en_fr_x_private1_private2"
|
||||
string(2) "en"
|
||||
Reference in New Issue
Block a user