From 21664fb9357a6a89f3b228a6fc7a0d07b396908b Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Sat, 4 Apr 2026 15:53:26 +0200 Subject: [PATCH 1/3] Convert remaining K&R function declarations in libbcmath These are already converted in 8.3. Backport minimal changes to 8.2, as the latest version of Clang on macOS has stopped supporting the K&R syntax. Closes GH-21636 --- ext/bcmath/libbcmath/src/add.c | 5 +---- ext/bcmath/libbcmath/src/compare.c | 10 ++-------- ext/bcmath/libbcmath/src/doaddsub.c | 10 ++-------- ext/bcmath/libbcmath/src/init.c | 9 ++------- ext/bcmath/libbcmath/src/int2num.c | 5 +---- ext/bcmath/libbcmath/src/nearzero.c | 5 +---- ext/bcmath/libbcmath/src/neg.c | 4 +--- ext/bcmath/libbcmath/src/num2long.c | 4 +--- ext/bcmath/libbcmath/src/num2str.c | 5 +---- ext/bcmath/libbcmath/src/rmzero.c | 4 +--- ext/bcmath/libbcmath/src/sub.c | 5 +---- 11 files changed, 14 insertions(+), 52 deletions(-) diff --git a/ext/bcmath/libbcmath/src/add.c b/ext/bcmath/libbcmath/src/add.c index e92fb0502f014..3d76e028909e8 100644 --- a/ext/bcmath/libbcmath/src/add.c +++ b/ext/bcmath/libbcmath/src/add.c @@ -42,10 +42,7 @@ N1 is added to N2 and the result placed into RESULT. SCALE_MIN is the minimum scale for the result. */ -void -bc_add (n1, n2, result, scale_min) - bc_num n1, n2, *result; - int scale_min; +void bc_add(bc_num n1, bc_num n2, bc_num *result, int scale_min) { bc_num sum = NULL; int cmp_res; diff --git a/ext/bcmath/libbcmath/src/compare.c b/ext/bcmath/libbcmath/src/compare.c index f7c4a403993e7..dda2d544fb4c6 100644 --- a/ext/bcmath/libbcmath/src/compare.c +++ b/ext/bcmath/libbcmath/src/compare.c @@ -42,11 +42,7 @@ than N2 and +1 if N1 is greater than N2. If USE_SIGN is false, just compare the magnitudes. */ - int -_bc_do_compare (n1, n2, use_sign, ignore_last) - bc_num n1, n2; - int use_sign; - int ignore_last; +int _bc_do_compare(bc_num n1, bc_num n2, int use_sign, int ignore_last) { char *n1ptr, *n2ptr; int count; @@ -151,9 +147,7 @@ _bc_do_compare (n1, n2, use_sign, ignore_last) /* This is the "user callable" routine to compare numbers N1 and N2. */ -int -bc_compare (n1, n2) - bc_num n1, n2; +int bc_compare(bc_num n1, bc_num n2) { return _bc_do_compare (n1, n2, TRUE, FALSE); } diff --git a/ext/bcmath/libbcmath/src/doaddsub.c b/ext/bcmath/libbcmath/src/doaddsub.c index fcd768f2929f8..d3db98167d4d2 100644 --- a/ext/bcmath/libbcmath/src/doaddsub.c +++ b/ext/bcmath/libbcmath/src/doaddsub.c @@ -42,10 +42,7 @@ returned. The signs of N1 and N2 are ignored. SCALE_MIN is to set the minimum scale of the result. */ - bc_num -_bc_do_add (n1, n2, scale_min) - bc_num n1, n2; - int scale_min; +bc_num _bc_do_add(bc_num n1, bc_num n2, int scale_min) { bc_num sum; int sum_scale, sum_digits; @@ -134,10 +131,7 @@ _bc_do_add (n1, n2, scale_min) assumed to be larger than N2. SCALE_MIN is the minimum scale of the result. */ - bc_num -_bc_do_sub (n1, n2, scale_min) - bc_num n1, n2; - int scale_min; +bc_num _bc_do_sub(bc_num n1, bc_num n2, int scale_min) { bc_num diff; int diff_scale, diff_len; diff --git a/ext/bcmath/libbcmath/src/init.c b/ext/bcmath/libbcmath/src/init.c index 96e934b34da76..79a58ef6bba4f 100644 --- a/ext/bcmath/libbcmath/src/init.c +++ b/ext/bcmath/libbcmath/src/init.c @@ -39,9 +39,7 @@ /* new_num allocates a number and sets fields to known values. */ -bc_num -_bc_new_num_ex (length, scale, persistent) - int length, scale, persistent; +bc_num _bc_new_num_ex(int length, int scale, int persistent) { bc_num temp; /* PHP Change: malloc() -> pemalloc(), removed free_list code */ @@ -61,10 +59,7 @@ _bc_new_num_ex (length, scale, persistent) /* "Frees" a bc_num NUM. Actually decreases reference count and only frees the storage if reference count is zero. */ -void -_bc_free_num_ex (num, persistent) - bc_num *num; - int persistent; +void _bc_free_num_ex(bc_num *num, int persistent) { if (*num == NULL) return; (*num)->n_refs--; diff --git a/ext/bcmath/libbcmath/src/int2num.c b/ext/bcmath/libbcmath/src/int2num.c index 3e675b627a8c4..274768529a3de 100644 --- a/ext/bcmath/libbcmath/src/int2num.c +++ b/ext/bcmath/libbcmath/src/int2num.c @@ -40,10 +40,7 @@ /* Convert an integer VAL to a bc number NUM. */ -void -bc_int2num (num, val) - bc_num *num; - int val; +void bc_int2num(bc_num *num, int val) { char buffer[30]; char *bptr, *vptr; diff --git a/ext/bcmath/libbcmath/src/nearzero.c b/ext/bcmath/libbcmath/src/nearzero.c index 0986b02b7a9ce..fab72bedf3742 100644 --- a/ext/bcmath/libbcmath/src/nearzero.c +++ b/ext/bcmath/libbcmath/src/nearzero.c @@ -41,10 +41,7 @@ Specifically, all but the last digit is 0 and the last digit is 1. Last digit is defined by scale. */ -char -bc_is_near_zero (num, scale) - bc_num num; - int scale; +char bc_is_near_zero(bc_num num, int scale) { int count; char *nptr; diff --git a/ext/bcmath/libbcmath/src/neg.c b/ext/bcmath/libbcmath/src/neg.c index fe6f95aa34c85..748606c185b3c 100644 --- a/ext/bcmath/libbcmath/src/neg.c +++ b/ext/bcmath/libbcmath/src/neg.c @@ -39,9 +39,7 @@ /* In some places we need to check if the number is negative. */ -char -bc_is_neg (num) - bc_num num; +char bc_is_neg(bc_num num) { return num->n_sign == MINUS; } diff --git a/ext/bcmath/libbcmath/src/num2long.c b/ext/bcmath/libbcmath/src/num2long.c index e40a126c72cb6..802c623e81af4 100644 --- a/ext/bcmath/libbcmath/src/num2long.c +++ b/ext/bcmath/libbcmath/src/num2long.c @@ -42,9 +42,7 @@ a long, this function returns a zero. This can be detected by checking the NUM for zero after having a zero returned. */ -long -bc_num2long (num) - bc_num num; +long bc_num2long(bc_num num) { long val; char *nptr; diff --git a/ext/bcmath/libbcmath/src/num2str.c b/ext/bcmath/libbcmath/src/num2str.c index 39f7adb1f0c39..44b05593c944f 100644 --- a/ext/bcmath/libbcmath/src/num2str.c +++ b/ext/bcmath/libbcmath/src/num2str.c @@ -39,10 +39,7 @@ /* Convert a numbers to a string. Base 10 only.*/ -zend_string -*bc_num2str_ex (num, scale) - bc_num num; - int scale; +zend_string *bc_num2str_ex(bc_num num, int scale) { zend_string *str; char *sptr; diff --git a/ext/bcmath/libbcmath/src/rmzero.c b/ext/bcmath/libbcmath/src/rmzero.c index 5e295c90af4d2..c1d85c0a91ac4 100644 --- a/ext/bcmath/libbcmath/src/rmzero.c +++ b/ext/bcmath/libbcmath/src/rmzero.c @@ -41,9 +41,7 @@ _bc_rm_leading_zeros just moves the data "value" pointer to the correct place and adjusts the length. */ - void -_bc_rm_leading_zeros (num) - bc_num num; +void _bc_rm_leading_zeros(bc_num num) { /* We can move n_value to point to the first non zero digit! */ while (*num->n_value == 0 && num->n_len > 1) { diff --git a/ext/bcmath/libbcmath/src/sub.c b/ext/bcmath/libbcmath/src/sub.c index 2949c71fbb664..9da5e892db96a 100644 --- a/ext/bcmath/libbcmath/src/sub.c +++ b/ext/bcmath/libbcmath/src/sub.c @@ -42,10 +42,7 @@ N2 is subtracted from N1 and the result placed in RESULT. SCALE_MIN is the minimum scale for the result. */ -void -bc_sub (n1, n2, result, scale_min) - bc_num n1, n2, *result; - int scale_min; +void bc_sub(bc_num n1, bc_num n2, bc_num *result, int scale_min) { bc_num diff = NULL; int cmp_res; From 3d8cb61f879dd74d7c44eccdf1c572eb6d1c3860 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Sun, 5 Apr 2026 05:32:47 +0800 Subject: [PATCH 2/3] [skip ci] ext/intl: Fix various typo (GH-21615) --- ext/intl/ERROR_CONVENTIONS.md | 4 ++-- ext/intl/collator/collator_convert.cpp | 2 +- ext/intl/collator/collator_sort.cpp | 2 +- ext/intl/formatter/formatter_data.cpp | 2 +- ext/intl/intl_error.h | 2 +- ext/intl/locale/locale_methods.cpp | 4 ++-- ext/intl/transliterator/transliterator_class.cpp | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/intl/ERROR_CONVENTIONS.md b/ext/intl/ERROR_CONVENTIONS.md index 432862afd6855..4b29101a0a868 100644 --- a/ext/intl/ERROR_CONVENTIONS.md +++ b/ext/intl/ERROR_CONVENTIONS.md @@ -40,7 +40,7 @@ no way to pass ownership of the string without it being copied. unless the error is due to bad arguments, in which case only the global error should be set. -Objects store an intl_error structed in their private data. For instance: +Objects store an intl_error in their private data. For instance: ```c typedef struct { @@ -59,7 +59,7 @@ void intl_errors_set_code(intl_error* err, UErrorCode err_code); void intl_errors_set(intl_error* err, UErrorCode code, char* msg, int copyMsg); ``` -by passing a pointer to the object's `intl_error` structed as the first parameter. +by passing a pointer to the object's `intl_error` as the first parameter. Node the extra `s` in the functions' names (`errors`, not `error`). Static methods should only set the global error. diff --git a/ext/intl/collator/collator_convert.cpp b/ext/intl/collator/collator_convert.cpp index d4de15aa0b822..aa49661f8d770 100644 --- a/ext/intl/collator/collator_convert.cpp +++ b/ext/intl/collator/collator_convert.cpp @@ -289,7 +289,7 @@ U_CFUNC zval* collator_convert_string_to_double( zval* str, zval *rv ) /* {{{ collator_convert_string_to_number_if_possible * - * Convert string to numer. + * Convert string to number. * * @param zval* str String to convert. * diff --git a/ext/intl/collator/collator_sort.cpp b/ext/intl/collator/collator_sort.cpp index 003d7f45a837f..2f8685e61e30c 100644 --- a/ext/intl/collator/collator_sort.cpp +++ b/ext/intl/collator/collator_sort.cpp @@ -380,7 +380,7 @@ U_CFUNC PHP_FUNCTION( collator_sort_with_sort_keys ) if( !hash || zend_hash_num_elements( hash ) == 0 ) RETURN_TRUE; - /* Create bufers */ + /* Create buffers */ sortKeyBuf = reinterpret_cast(ecalloc( sortKeyBufSize, sizeof( char ) )); sortKeyIndxBuf = reinterpret_cast(ecalloc( sortKeyIndxBufSize, sizeof( uint8_t ) )); utf16_buf = eumalloc( utf16_buf_size ); diff --git a/ext/intl/formatter/formatter_data.cpp b/ext/intl/formatter/formatter_data.cpp index 095be92ed29e1..a9e48d0b14d85 100644 --- a/ext/intl/formatter/formatter_data.cpp +++ b/ext/intl/formatter/formatter_data.cpp @@ -32,7 +32,7 @@ void formatter_data_init( formatter_data* nf_data ) /* }}} */ /* {{{ void formatter_data_free( formatter_data* nf_data ) - * Clean up mem allocted by internals of formatter_data + * Clean up mem allocated by internals of formatter_data */ void formatter_data_free( formatter_data* nf_data ) { diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h index 8a9bff0b271c0..d8d9fac97bf29 100644 --- a/ext/intl/intl_error.h +++ b/ext/intl/intl_error.h @@ -37,7 +37,7 @@ void intl_error_set( intl_error* err, UErrorCode code, const char* msg); UErrorCode intl_error_get_code( intl_error* err ); zend_string* intl_error_get_message( intl_error* err ); -// Wrappers to synchonize object's and global error structures. +// Wrappers to synchronize object's and global error structures. void intl_errors_reset( intl_error* err ); void intl_errors_set_custom_msg( intl_error* err, const char* msg); void intl_errors_set_code( intl_error* err, UErrorCode err_code ); diff --git a/ext/intl/locale/locale_methods.cpp b/ext/intl/locale/locale_methods.cpp index 8f09e5c116e11..cff62b503395f 100644 --- a/ext/intl/locale/locale_methods.cpp +++ b/ext/intl/locale/locale_methods.cpp @@ -254,7 +254,7 @@ static zend_off_t getStrrtokenPos(char* str, zend_off_t savedPos) } } if(result < 1){ - /* Just in case inavlid locale e.g. '-x-xyz' or '-sl_Latn' */ + /* Just in case invalid locale e.g. '-x-xyz' or '-sl_Latn' */ result =-1; } return result; @@ -362,7 +362,7 @@ static zend_string* get_icu_value_internal( const char* loc_name , const char* t if( strcmp(tag_name , LOC_LANG_TAG)==0 ){ return zend_string_init(loc_name, strlen(loc_name), 0); } else { - /* Since Grandfathered , no value , do nothing , retutn NULL */ + /* Since Grandfathered , no value , do nothing , return NULL */ return NULL; } } diff --git a/ext/intl/transliterator/transliterator_class.cpp b/ext/intl/transliterator/transliterator_class.cpp index fd0cd4f3c3e64..3525872d77f60 100644 --- a/ext/intl/transliterator/transliterator_class.cpp +++ b/ext/intl/transliterator/transliterator_class.cpp @@ -80,7 +80,7 @@ static void transliterator_object_init( Transliterator_object* to ) /* }}} */ /* {{{ void transliterator_object_destroy( Transliterator_object* to ) - * Clean up mem allocted by internals of Transliterator_object + * Clean up mem allocated by internals of Transliterator_object */ static void transliterator_object_destroy( Transliterator_object* to ) { From 4cc691ae46a74feb8f777a7ffb4c439e3486f444 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Sat, 4 Apr 2026 23:39:27 +0200 Subject: [PATCH 3/3] Fix file cache for zend_arg_info.doc_comment --- ext/opcache/zend_file_cache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 3114e5b92712c..dac6f3b482f5a 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -659,6 +659,7 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra SERIALIZE_STR(p->name); } zend_file_cache_serialize_type(&p->type, script, info, buf); + SERIALIZE_STR(p->doc_comment); p++; } } @@ -1562,6 +1563,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr UNSERIALIZE_STR(p->name); } zend_file_cache_unserialize_type(&p->type, (op_array->fn_flags & ZEND_ACC_CLOSURE) ? NULL : op_array->scope, script, buf); + UNSERIALIZE_STR(p->doc_comment); p++; } }