Commit cff33786f60 for php.net
commit cff33786f6007b0868db7931b45c7c312275f187
Author: Weilin Du <weilindu@php.net>
Date: Fri Jun 26 20:34:56 2026 +0800
ext/intl: add const qualifiers (#22465)
Add several const qualifiers.
diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp
index 80505748901..d792a636713 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.cpp
+++ b/ext/intl/breakiterator/breakiterator_iterators.cpp
@@ -65,7 +65,7 @@ static void _breakiterator_move_forward(zend_object_iterator *iter)
return;
}
- int32_t pos = biter->next();
+ const int32_t pos = biter->next();
if (pos != BreakIterator::DONE) {
ZVAL_LONG(&zoi_iter->current, (zend_long)pos);
} //else we've reached the end of the enum, nothing more is required
@@ -76,7 +76,7 @@ static void _breakiterator_rewind(zend_object_iterator *iter)
BreakIterator *biter = _breakiter_prolog(iter);
zoi_with_current *zoi_iter = (zoi_with_current*)iter;
- int32_t pos = biter->first();
+ const int32_t pos = biter->first();
ZVAL_LONG(&zoi_iter->current, (zend_long)pos);
}
diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp
index 66a35e65ac6..60659915bf8 100644
--- a/ext/intl/breakiterator/breakiterator_methods.cpp
+++ b/ext/intl/breakiterator/breakiterator_methods.cpp
@@ -171,7 +171,7 @@ static void _breakiter_no_args_ret_int32(
BREAKITER_METHOD_FETCH_OBJECT;
- int32_t res = (bio->biter->*func)();
+ const int32_t res = (bio->biter->*func)();
RETURN_LONG((zend_long)res);
}
@@ -195,7 +195,7 @@ static void _breakiter_int32_ret_int32(
RETURN_THROWS();
}
- int32_t res = (bio->biter->*func)((int32_t)arg);
+ const int32_t res = (bio->biter->*func)((int32_t)arg);
RETURN_LONG((zend_long)res);
}
@@ -246,7 +246,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, current)
BREAKITER_METHOD_FETCH_OBJECT;
- int32_t res = bio->biter->current();
+ const int32_t res = bio->biter->current();
RETURN_LONG((zend_long)res);
}
@@ -282,7 +282,7 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, isBoundary)
BREAKITER_METHOD_FETCH_OBJECT;
- UBool res = bio->biter->isBoundary((int32_t)offset);
+ const UBool res = bio->biter->isBoundary((int32_t)offset);
RETURN_BOOL((zend_long)res);
}
diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp
index 63b203d08d4..c74f0ab9412 100644
--- a/ext/intl/calendar/calendar_class.cpp
+++ b/ext/intl/calendar/calendar_class.cpp
@@ -192,7 +192,7 @@ static HashTable *Calendar_get_debug_info(zend_object *object, int *is_temp)
i++) {
UErrorCode uec = U_ZERO_ERROR;
const char *name = debug_info_fields[i].name;
- int32_t res = cal->get(debug_info_fields[i].field, uec);
+ const int32_t res = cal->get(debug_info_fields[i].field, uec);
if (U_SUCCESS(uec)) {
add_assoc_long(&zfields, name, (zend_long)res);
} else {
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp
index fe4749d6d62..fcb2e56bb89 100644
--- a/ext/intl/calendar/calendar_methods.cpp
+++ b/ext/intl/calendar/calendar_methods.cpp
@@ -226,7 +226,7 @@ static void _php_intlcal_field_uec_ret_in32t_method(
CALENDAR_METHOD_FETCH_OBJECT;
- int32_t result = (co->ucal->*func)(
+ const int32_t result = (co->ucal->*func)(
(UCalendarDateFields)field, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");
@@ -250,7 +250,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_time)
CALENDAR_METHOD_FETCH_OBJECT;
- UDate result = co->ucal->getTime(CALENDAR_ERROR_CODE(co));
+ const UDate result = co->ucal->getTime(CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "error calling ICU Calendar::getTime");
RETURN_DOUBLE((double)result);
@@ -377,7 +377,7 @@ static void _php_intlcal_before_after(
RETURN_THROWS();
}
- UBool res = (co->ucal->*func)(*when_co->ucal, CALENDAR_ERROR_CODE(co));
+ const UBool res = (co->ucal->*func)(*when_co->ucal, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Error calling ICU method");
RETURN_BOOL((int)res);
@@ -401,7 +401,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set)
object = getThis();
- int arg_num = ZEND_NUM_ARGS() - (object ? 0 : 1);
+ const int arg_num = ZEND_NUM_ARGS() - (object ? 0 : 1);
if (object && arg_num > 2) {
zend_error(E_DEPRECATED, "Calling IntlCalendar::set() with more than 2 arguments is deprecated, "
@@ -564,7 +564,7 @@ U_CFUNC PHP_FUNCTION(intlcal_field_difference)
CALENDAR_METHOD_FETCH_OBJECT;
- int32_t result = co->ucal->fieldDifference((UDate)when,
+ const int32_t result = co->ucal->fieldDifference((UDate)when,
(UCalendarDateFields)field, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");
@@ -597,7 +597,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type)
CALENDAR_METHOD_FETCH_OBJECT;
- int32_t result = co->ucal->getDayOfWeekType(
+ const int32_t result = co->ucal->getDayOfWeekType(
(UCalendarDaysOfWeek)dow, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");
@@ -615,7 +615,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_first_day_of_week)
CALENDAR_METHOD_FETCH_OBJECT;
- int32_t result = co->ucal->getFirstDayOfWeek(CALENDAR_ERROR_CODE(co));
+ const int32_t result = co->ucal->getFirstDayOfWeek(CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");
RETURN_LONG((zend_long)result);
@@ -637,7 +637,7 @@ static void _php_intlcal_field_ret_in32t_method(
CALENDAR_METHOD_FETCH_OBJECT;
- int32_t result = (co->ucal->*func)((UCalendarDateFields)field);
+ const int32_t result = (co->ucal->*func)((UCalendarDateFields)field);
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");
RETURN_LONG((zend_long)result);
@@ -696,7 +696,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_minimal_days_in_first_week)
CALENDAR_METHOD_FETCH_OBJECT;
- uint8_t result = co->ucal->getMinimalDaysInFirstWeek();
+ const uint8_t result = co->ucal->getMinimalDaysInFirstWeek();
/* TODO Is it really a failure? */
INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed");
@@ -758,7 +758,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition)
CALENDAR_METHOD_FETCH_OBJECT;
- int32_t res = co->ucal->getWeekendTransition((UCalendarDaysOfWeek)dow,
+ const int32_t res = co->ucal->getWeekendTransition((UCalendarDaysOfWeek)dow,
CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Error calling ICU method");
@@ -776,7 +776,7 @@ U_CFUNC PHP_FUNCTION(intlcal_in_daylight_time)
CALENDAR_METHOD_FETCH_OBJECT;
- UBool ret = co->ucal->inDaylightTime(CALENDAR_ERROR_CODE(co));
+ const UBool ret = co->ucal->inDaylightTime(CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Error calling ICU method");
RETURN_BOOL((int)ret);
@@ -852,7 +852,7 @@ U_CFUNC PHP_FUNCTION(intlcal_is_weekend)
if (date_is_null) {
RETURN_BOOL((int)co->ucal->isWeekend());
} else {
- UBool ret = co->ucal->isWeekend((UDate)date, CALENDAR_ERROR_CODE(co));
+ const UBool ret = co->ucal->isWeekend((UDate)date, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "Error calling ICU method");
RETURN_BOOL((int)ret);
}
@@ -937,7 +937,7 @@ U_CFUNC PHP_FUNCTION(intlcal_equals)
RETURN_THROWS();
}
- UBool result = co->ucal->equals(*other_co->ucal, CALENDAR_ERROR_CODE(co));
+ const UBool result = co->ucal->equals(*other_co->ucal, CALENDAR_ERROR_CODE(co));
INTL_METHOD_CHECK_STATUS(co, "error calling ICU Calendar::equals");
RETURN_BOOL((int)result);
@@ -1116,7 +1116,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)
/* There are no exported functions in ext/date to this
* in a more native fashion */
- double date = co->ucal->getTime(CALENDAR_ERROR_CODE(co)) / 1000.;
+ const double date = co->ucal->getTime(CALENDAR_ERROR_CODE(co)) / 1000.;
int64_t ts;
char ts_str[sizeof("@-9223372036854775808")];
int ts_str_len;
diff --git a/ext/intl/converter/converter.cpp b/ext/intl/converter/converter.cpp
index 88f05136bbb..30855d1b0c5 100644
--- a/ext/intl/converter/converter.cpp
+++ b/ext/intl/converter/converter.cpp
@@ -159,7 +159,7 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode
return;
case IS_LONG:
{
- zend_long lval = Z_LVAL_P(val);
+ const zend_long lval = Z_LVAL_P(val);
if ((lval < 0) || (lval > 0x10FFFF)) {
php_converter_throw_failure(objval, U_ILLEGAL_ARGUMENT_ERROR, "Invalid codepoint U+%04lx", lval);
return;
@@ -265,7 +265,7 @@ static void php_converter_append_fromUnicode_target(zval *val, UConverterFromUni
return;
case IS_STRING:
{
- size_t vallen = Z_STRLEN_P(val);
+ const size_t vallen = Z_STRLEN_P(val);
if (TARGET_CHECK(args, vallen)) {
args->target = reinterpret_cast<char *>(zend_mempcpy(args->target, Z_STRVAL_P(val), vallen));
}
@@ -682,7 +682,7 @@ static zend_string* php_converter_do_convert(UConverter *dest_cnv,
}
/* }}} */
-static void php_converter_set_subst_chars(UConverter *cnv, zend_string *subst, UErrorCode *error)
+static void php_converter_set_subst_chars(UConverter *cnv, const zend_string *subst, UErrorCode *error)
{
if (ZSTR_LEN(subst) > SCHAR_MAX) {
*error = U_ILLEGAL_ARGUMENT_ERROR;
diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp
index 5b0950094d5..52199a305f0 100644
--- a/ext/intl/dateformat/dateformat_format_object.cpp
+++ b/ext/intl/dateformat/dateformat_format_object.cpp
@@ -50,9 +50,9 @@ static constexpr DateFormat::EStyle valid_styles[] = {
DateFormat::kShortRelative,
};
-static bool valid_format(zval *z) {
+static bool valid_format(const zval *z) {
if (Z_TYPE_P(z) == IS_LONG) {
- zend_long lval = Z_LVAL_P(z);
+ const zend_long lval = Z_LVAL_P(z);
for (int i = 0; i < sizeof(valid_styles) / sizeof(*valid_styles); i++) {
if ((zend_long)valid_styles[i] == lval) {
return true;
@@ -149,7 +149,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
timeStyle = (DateFormat::EStyle)(timeStyle & ~DateFormat::kRelative);
}
- zend_class_entry *instance_ce = object->ce;
+ const zend_class_entry *instance_ce = object->ce;
if (instanceof_function(instance_ce, Calendar_ce_ptr)) {
Calendar *obj_cal = calendar_fetch_native_calendar(object);
if (obj_cal == NULL) {
diff --git a/ext/intl/dateformat/dateformat_parse.cpp b/ext/intl/dateformat/dateformat_parse.cpp
index 13cf56ad7d8..d818627439e 100644
--- a/ext/intl/dateformat/dateformat_parse.cpp
+++ b/ext/intl/dateformat/dateformat_parse.cpp
@@ -33,7 +33,7 @@ extern "C" {
* if set to 1 - store any error encountered in the parameter parse_error
* if set to 0 - no need to store any error encountered in the parameter parse_error
*/
-static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* text_to_parse, size_t text_len, int32_t *parse_pos, bool update_calendar, zval *return_value)
+static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, const char* text_to_parse, size_t text_len, int32_t *parse_pos, bool update_calendar, zval *return_value)
{
double result = 0;
UDate timestamp =0;
@@ -70,9 +70,9 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex
}
/* }}} */
-static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, zend_long calendar_field, char* key_name)
+static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, zend_long calendar_field, const char* key_name)
{
- zend_long calendar_field_val = ucal_get( parsed_calendar, static_cast<UCalendarDateFields>(calendar_field), &INTL_DATA_ERROR_CODE(dfo));
+ const zend_long calendar_field_val = ucal_get( parsed_calendar, static_cast<UCalendarDateFields>(calendar_field), &INTL_DATA_ERROR_CODE(dfo));
INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : could not get a field from calendar" );
if( strcmp(key_name, CALENDAR_YEAR )==0 ){
@@ -87,7 +87,7 @@ static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_va
}
/* {{{ Internal function which calls the udat_parseCalendar */
-static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* text_to_parse, size_t text_len, int32_t *parse_pos, zval *return_value)
+static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, const char* text_to_parse, size_t text_len, int32_t *parse_pos, zval *return_value)
{
UCalendar *parsed_calendar = NULL;
UChar* text_utf16 = NULL;
@@ -149,7 +149,7 @@ U_CFUNC PHP_FUNCTION(datefmt_parse)
if (z_parse_pos) {
zval *z_parse_pos_tmp = z_parse_pos;
ZVAL_DEREF(z_parse_pos_tmp);
- zend_long long_parse_pos = zval_get_long(z_parse_pos_tmp);
+ const zend_long long_parse_pos = zval_get_long(z_parse_pos_tmp);
if (ZEND_LONG_INT_OVFL(long_parse_pos)) {
intl_error_set_code(NULL, U_ILLEGAL_ARGUMENT_ERROR);
intl_error_set_custom_msg(NULL, "String index is out of valid range.");
@@ -188,7 +188,7 @@ U_CFUNC PHP_METHOD(IntlDateFormatter, parseToCalendar)
if (z_parse_pos) {
bool failed;
- zend_long long_parse_pos = zval_try_get_long(z_parse_pos, &failed);
+ const zend_long long_parse_pos = zval_try_get_long(z_parse_pos, &failed);
if (failed) {
zend_argument_type_error(2, "must be of type int, %s given", zend_zval_value_name(z_parse_pos));
RETURN_THROWS();
@@ -231,7 +231,7 @@ U_CFUNC PHP_FUNCTION(datefmt_localtime)
if (z_parse_pos) {
zval *z_parse_pos_tmp = z_parse_pos;
ZVAL_DEREF(z_parse_pos_tmp);
- zend_long long_parse_pos = zval_get_long(z_parse_pos_tmp);
+ const zend_long long_parse_pos = zval_get_long(z_parse_pos_tmp);
if (ZEND_LONG_INT_OVFL(long_parse_pos)) {
intl_error_set_code(NULL, U_ILLEGAL_ARGUMENT_ERROR);
intl_error_set_custom_msg(NULL, "String index is out of valid range.");
diff --git a/ext/intl/formatter/formatter_attr.cpp b/ext/intl/formatter/formatter_attr.cpp
index d21873ecdab..4e97ad7f710 100644
--- a/ext/intl/formatter/formatter_attr.cpp
+++ b/ext/intl/formatter/formatter_attr.cpp
@@ -74,7 +74,7 @@ U_CFUNC PHP_FUNCTION( numfmt_get_attribute )
break;
case UNUM_ROUNDING_INCREMENT:
{
- double value_double = unum_getDoubleAttribute(FORMATTER_UNUM(nfo), attribute);
+ const double value_double = unum_getDoubleAttribute(FORMATTER_UNUM(nfo), attribute);
if(value_double == -1) {
INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR;
} else {
diff --git a/ext/intl/formatter/formatter_parse.cpp b/ext/intl/formatter/formatter_parse.cpp
index 7bbc461516b..a475960809b 100644
--- a/ext/intl/formatter/formatter_parse.cpp
+++ b/ext/intl/formatter/formatter_parse.cpp
@@ -171,7 +171,7 @@ U_CFUNC PHP_FUNCTION( numfmt_parse_currency )
ZEND_TRY_ASSIGN_REF_LONG(zposition, pp.getIndex());
}
- double number = currAmt->getNumber().getDouble(INTL_DATA_ERROR_CODE(nfo));
+ const double number = currAmt->getNumber().getDouble(INTL_DATA_ERROR_CODE(nfo));
/* Convert parsed currency to UTF-8 and pass it back to caller. */
icu::UnicodeString ucurrency(currAmt->getISOCurrency());
diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c
index f19a5ec617d..eab1b747815 100644
--- a/ext/intl/intl_error.c
+++ b/ext/intl/intl_error.c
@@ -132,7 +132,7 @@ zend_string * intl_error_get_message( intl_error* err )
return ZSTR_EMPTY_ALLOC();
uErrorName = u_errorName( err->code );
- size_t uErrorLen = strlen(uErrorName);
+ const size_t uErrorLen = strlen(uErrorName);
/* Format output string */
if (err->custom_error_message) {
diff --git a/ext/intl/listformatter/listformatter_class.cpp b/ext/intl/listformatter/listformatter_class.cpp
index 221dadfcd3b..0f432b0e605 100644
--- a/ext/intl/listformatter/listformatter_class.cpp
+++ b/ext/intl/listformatter/listformatter_class.cpp
@@ -138,7 +138,7 @@ PHP_METHOD(IntlListFormatter, format)
intl_errors_reset(LISTFORMATTER_ERROR_P(obj));
- uint32_t count = zend_hash_num_elements(ht);
+ const uint32_t count = zend_hash_num_elements(ht);
if (count == 0) {
RETURN_EMPTY_STRING();
}
diff --git a/ext/intl/locale/locale_methods.cpp b/ext/intl/locale/locale_methods.cpp
index ffcba02d322..14fa2a8f6bf 100644
--- a/ext/intl/locale/locale_methods.cpp
+++ b/ext/intl/locale/locale_methods.cpp
@@ -1660,7 +1660,7 @@ U_CFUNC PHP_FUNCTION(locale_add_likely_subtags)
locale = (char *)intl_locale_get_default();
}
- int32_t maximized_locale_len = uloc_addLikelySubtags(locale, maximized_locale, sizeof(maximized_locale), &status);
+ const int32_t maximized_locale_len = uloc_addLikelySubtags(locale, maximized_locale, sizeof(maximized_locale), &status);
INTL_CHECK_STATUS(status, "invalid locale");
if (maximized_locale_len < 0) {
RETURN_FALSE;
@@ -1683,7 +1683,7 @@ U_CFUNC PHP_FUNCTION(locale_minimize_subtags)
locale = (char *)intl_locale_get_default();
}
- int32_t minimized_locale_len = uloc_minimizeSubtags(locale, minimized_locale, sizeof(minimized_locale), &status);
+ const int32_t minimized_locale_len = uloc_minimizeSubtags(locale, minimized_locale, sizeof(minimized_locale), &status);
INTL_CHECK_STATUS(status, "invalid locale");
if (minimized_locale_len < 0) {
RETURN_FALSE;
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index 12e05af5721..e676a07416c 100644
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -184,7 +184,7 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
(void*)&bogusType, sizeof(bogusType));
}
} else if (name_part.getType() == UMSGPAT_PART_TYPE_ARG_NUMBER) {
- int32_t argNumber = name_part.getValue();
+ const int32_t argNumber = name_part.getValue();
if (argNumber < 0) {
intl_errors_set(&err, U_INVALID_FORMAT_ERROR,
"Found part with negative number");
@@ -364,7 +364,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
UChar **formatted,
int32_t *formatted_len)
{
- int arg_count = zend_hash_num_elements(args);
+ const int arg_count = zend_hash_num_elements(args);
std::vector<Formattable> fargs;
std::vector<UnicodeString> farg_names;
MessageFormat *mf = (MessageFormat *)mfo->mf_data.umsgf;
@@ -408,7 +408,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
}
UChar temp[16];
- int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index);
+ const int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index);
key.append(temp, len);
storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, num_index);
@@ -467,7 +467,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
}
case Formattable::kDouble:
{
- double d = zval_get_double(elem);
+ const double d = zval_get_double(elem);
formattable.setDouble(d);
break;
}
@@ -523,7 +523,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
}
case Formattable::kDate:
{
- double dd = intl_zval_to_millis(elem, &err);
+ const double dd = intl_zval_to_millis(elem, &err);
if (U_FAILURE(err.code)) {
char *message;
zend_string *u8key;
diff --git a/ext/intl/msgformat/msgformat_parse.cpp b/ext/intl/msgformat/msgformat_parse.cpp
index b50dc1efed4..e177d3aca7f 100644
--- a/ext/intl/msgformat/msgformat_parse.cpp
+++ b/ext/intl/msgformat/msgformat_parse.cpp
@@ -27,7 +27,7 @@ extern "C" {
}
/* {{{ */
-static void msgfmt_do_parse(MessageFormatter_object *mfo, char *source, size_t src_len, zval *return_value)
+static void msgfmt_do_parse(MessageFormatter_object *mfo, const char *source, size_t src_len, zval *return_value)
{
zval *fargs;
int count = 0;
diff --git a/ext/intl/rangeformatter/rangeformatter_class.cpp b/ext/intl/rangeformatter/rangeformatter_class.cpp
index 2df252d1986..f933e0c0609 100644
--- a/ext/intl/rangeformatter/rangeformatter_class.cpp
+++ b/ext/intl/rangeformatter/rangeformatter_class.cpp
@@ -60,7 +60,7 @@ zend_object *IntlNumberRangeFormatter_object_create(zend_class_entry *ce)
return &intern->zo;
}
-static icu::Formattable rangeformatter_create_formattable(zval *number)
+static icu::Formattable rangeformatter_create_formattable(const zval *number)
{
icu::Formattable formattable;
diff --git a/ext/intl/resourcebundle/resourcebundle_class.cpp b/ext/intl/resourcebundle/resourcebundle_class.cpp
index 2a89b14cc6e..f796a6ffc8a 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.cpp
+++ b/ext/intl/resourcebundle/resourcebundle_class.cpp
@@ -174,7 +174,7 @@ static zval *resource_bundle_array_fetch(
{
int32_t index = 0;
char *key = NULL;
- bool is_numeric = offset_str == NULL;
+ const bool is_numeric = offset_str == NULL;
char *pbuf;
ResourceBundle_object *rb;
diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp
index 319e81c9a77..23b5511cf36 100644
--- a/ext/intl/timezone/timezone_class.cpp
+++ b/ext/intl/timezone/timezone_class.cpp
@@ -292,7 +292,7 @@ static HashTable *TimeZone_get_debug_info(zend_object *object, int *is_temp)
zend_hash_str_update(debug_info, "id", sizeof("id") - 1, &zv);
int32_t rawOffset, dstOffset;
- UDate now = Calendar::getNow();
+ const UDate now = Calendar::getNow();
tz->getOffset(now, false, rawOffset, dstOffset, uec);
if (U_FAILURE(uec)) {
return debug_info;
diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp
index 8f70a87487a..c2246c5406b 100644
--- a/ext/intl/timezone/timezone_methods.cpp
+++ b/ext/intl/timezone/timezone_methods.cpp
@@ -176,7 +176,7 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids)
RETURN_FALSE;
}
- int32_t result = TimeZone::countEquivalentIDs(id);
+ const int32_t result = TimeZone::countEquivalentIDs(id);
RETURN_LONG((zend_long)result);
}
@@ -279,7 +279,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_region)
RETURN_FALSE;
}
- int32_t region_len = TimeZone::getRegion(id, outbuf, sizeof(outbuf), status);
+ const int32_t region_len = TimeZone::getRegion(id, outbuf, sizeof(outbuf), status);
INTL_CHECK_STATUS(status, "error obtaining region");
RETURN_STRINGL(outbuf, region_len);
diff --git a/ext/intl/transliterator/transliterator_methods.cpp b/ext/intl/transliterator/transliterator_methods.cpp
index 16e5cf8b95d..45dd00b42bc 100644
--- a/ext/intl/transliterator/transliterator_methods.cpp
+++ b/ext/intl/transliterator/transliterator_methods.cpp
@@ -31,7 +31,7 @@ extern "C" {
#include <zend_exceptions.h>
-static int create_transliterator( char *str_id, size_t str_id_len, zend_long direction, zval *object )
+static int create_transliterator( const char *str_id, size_t str_id_len, zend_long direction, zval *object )
{
Transliterator_object *to;
UChar *ustr_id = nullptr;
diff --git a/ext/intl/uchar/uchar.cpp b/ext/intl/uchar/uchar.cpp
index 4f403cba818..83d5ab15d34 100644
--- a/ext/intl/uchar/uchar.cpp
+++ b/ext/intl/uchar/uchar.cpp
@@ -25,10 +25,10 @@ extern "C" {
#define IC_METHOD(mname) PHP_METHOD(IntlChar, mname)
-static inline int convert_cp(UChar32* pcp, zend_string *string_codepoint, zend_long int_codepoint) {
+static inline int convert_cp(UChar32* pcp, const zend_string *string_codepoint, zend_long int_codepoint) {
if (string_codepoint != NULL) {
int32_t i = 0;
- size_t string_codepoint_length = ZSTR_LEN(string_codepoint);
+ const size_t string_codepoint_length = ZSTR_LEN(string_codepoint);
if (ZEND_SIZE_T_INT_OVFL(string_codepoint_length)) {
intl_error_set_code(NULL, U_ILLEGAL_ARGUMENT_ERROR);