From 517d7d909da6f9773c543cf682ea71e67a3b4d66 Mon Sep 17 00:00:00 2001 From: Eric Mann Date: Wed, 12 Mar 2025 06:34:55 -0700 Subject: [PATCH 1/2] PHP-8.3 is now for PHP-8.3.20-dev --- NEWS | 4 ++-- Zend/zend.h | 2 +- configure.ac | 2 +- main/php_version.h | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index c54938982f5..e899b8ac86c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? ????, PHP 8.3.19 +?? ??? ????, PHP 8.3.20 - DOM: . Fix weird unpack behaviour in DOM. (nielsdos) @@ -19,7 +19,7 @@ PHP NEWS - Treewide: . Fixed bug GH-17736 (Assertion failure zend_reference_destroy()). (nielsdos) -27 Feb 2025, PHP 8.3.18 +13 Feb 2025, PHP 8.3.19 - BCMath: . Fixed bug GH-17398 (bcmul memory leak). (SakiTakamachi) diff --git a/Zend/zend.h b/Zend/zend.h index e795ac967a2..927088ea187 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -20,7 +20,7 @@ #ifndef ZEND_H #define ZEND_H -#define ZEND_VERSION "4.3.19-dev" +#define ZEND_VERSION "4.3.20-dev" #define ZEND_ENGINE_3 diff --git a/configure.ac b/configure.ac index 0e986138542..a94d4958492 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice. dnl ---------------------------------------------------------------------------- AC_PREREQ([2.68]) -AC_INIT([PHP],[8.3.19-dev],[https://github.com/php/php-src/issues],[php],[https://www.php.net]) +AC_INIT([PHP],[8.3.20-dev],[https://github.com/php/php-src/issues],[php],[https://www.php.net]) AC_CONFIG_SRCDIR([main/php_version.h]) AC_CONFIG_AUX_DIR([build]) AC_PRESERVE_HELP_ORDER diff --git a/main/php_version.h b/main/php_version.h index 8b508aaa335..3dee6de9332 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.ac to change version number */ #define PHP_MAJOR_VERSION 8 #define PHP_MINOR_VERSION 3 -#define PHP_RELEASE_VERSION 19 +#define PHP_RELEASE_VERSION 20 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "8.3.19-dev" -#define PHP_VERSION_ID 80319 +#define PHP_VERSION "8.3.20-dev" +#define PHP_VERSION_ID 80320 From c3fc94c4b8570509065c49df67436597afd94bc5 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Wed, 12 Mar 2025 20:07:34 +0000 Subject: [PATCH 2/2] ext/intl: fix locale_compose/locale_lookup to be able to deal with references. close GH-18035 --- NEWS | 4 +++ ext/intl/locale/locale_methods.c | 8 +++-- .../locale_compose_lookup_references.phpt | 29 +++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 ext/intl/tests/locale_compose_lookup_references.phpt diff --git a/NEWS b/NEWS index e899b8ac86c..39ee4c46bec 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,10 @@ PHP NEWS . Fixed bug GH-17984 (calls with arguments as array with references). (David Carlier) +- Intl: + . Fix locale_compose and locale_lookup to work with their array argument + with values as references. (David Carlier) + - Embed: . Fixed bug GH-8533 (Unable to link dynamic libphp on Mac). (Kévin Dunglas) diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index d6053b6be56..f810a61b6be 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -814,7 +814,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; @@ -857,7 +857,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); @@ -869,6 +869,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; } @@ -900,7 +901,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; @@ -1437,6 +1438,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 */ diff --git a/ext/intl/tests/locale_compose_lookup_references.phpt b/ext/intl/tests/locale_compose_lookup_references.phpt new file mode 100644 index 00000000000..f6a202f7512 --- /dev/null +++ b/ext/intl/tests/locale_compose_lookup_references.phpt @@ -0,0 +1,29 @@ +--TEST-- +locale_compose()/locale_lookup() with values as references. +--EXTENSIONS-- +intl +--FILE-- + '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"