[php-src] master: ext/intl: Remove icu-io as a dependency (#22891)

Weilin Du via GitHub <[email protected]> Sun, 26 Jul 2026 14:09:04 +0000
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Weilin Du (LamentXU123)
Committer: GitHub (web-flow)
Pusher: LamentXU123
Date: 2026-07-26T22:09:01+08:00

Commit: https://github.com/php/php-src/commit/be3477fc66c0e15ba9e21913afd4be7e55a3345e
Raw diff: https://github.com/php/php-src/commit/be3477fc66c0e15ba9e21913afd4be7e55a3345e.diff

ext/intl: Remove icu-io as a dependency (#22891)

This remove the dependency of the ICU IO library in the intl extension.

Changed paths:
  M  NEWS
  M  build/php.m4
  M  ext/intl/config.w32
  M  ext/intl/msgformat/msgformat_helpers.cpp


Diff:

diff --git a/NEWS b/NEWS
index dfcbac915197..91ac10efd3ba 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ PHP                                                                        NEWS
 - Intl:
   . Fixed grammatical issues in Normalizer invalid form and IntlCalendar time
     zone offset error messages. (Weilin Du)
+  . Removed the dependency on the ICU IO library. (Weilin Du)
 
 - ODBC:
   . Fixed bug GH-22668 (Heap buffer over-read when a column value exceeds the
diff --git a/build/php.m4 b/build/php.m4
index 6d9e3e21387b..d8bf0221e83e 100644
--- a/build/php.m4
+++ b/build/php.m4
@@ -1804,7 +1804,7 @@ dnl
 dnl Common setup macro for ICU.
 dnl
 AC_DEFUN([PHP_SETUP_ICU],[
-  PKG_CHECK_MODULES([ICU], [icu-uc >= 57.1 icu-io icu-i18n])
+  PKG_CHECK_MODULES([ICU], [icu-uc >= 57.1 icu-i18n])
 
   PHP_EVAL_INCLINE([$ICU_CFLAGS])
   PHP_EVAL_LIBLINE([$ICU_LIBS], [$1])
@@ -1812,7 +1812,7 @@ AC_DEFUN([PHP_SETUP_ICU],[
   ICU_CFLAGS="$ICU_CFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
   ICU_CXXFLAGS="$ICU_CXXFLAGS -DUNISTR_FROM_CHAR_EXPLICIT=explicit -DUNISTR_FROM_STRING_EXPLICIT=explicit"
 
-  AS_IF([$PKG_CONFIG icu-io --atleast-version=60],
+  AS_IF([$PKG_CONFIG icu-uc --atleast-version=60],
     [ICU_CFLAGS="$ICU_CFLAGS -DU_HIDE_OBSOLETE_UTF_OLD_H=1"])
 ])
 
diff --git a/ext/intl/config.w32 b/ext/intl/config.w32
index 016f17835f8e..fb30953697b6 100644
--- a/ext/intl/config.w32
+++ b/ext/intl/config.w32
@@ -5,7 +5,6 @@ ARG_ENABLE("intl", "Enable internationalization support", "no");
 if (PHP_INTL != "no") {
 	if (CHECK_LIB("icudt.lib", "intl", PHP_INTL) &&
 		CHECK_LIB("icuin.lib", "intl", PHP_INTL) &&
-		CHECK_LIB("icuio.lib", "intl", PHP_INTL) &&
 		CHECK_LIB("icuuc.lib", "intl", PHP_INTL) &&
 					CHECK_HEADER("unicode/utf.h", "CFLAGS_INTL")) {
 		// always build as shared - zend_strtod.c/ICU type conflict
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index e676a07416c2..da18527591d0 100644
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -21,7 +21,6 @@
 #include <limits.h>
 #include <unicode/msgfmt.h>
 #include <unicode/chariter.h>
-#include <unicode/ustdio.h>
 #include <unicode/timezone.h>
 #include <unicode/datefmt.h>
 #include <unicode/calendar.h>
@@ -407,9 +406,9 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
 				continue;
 			}
 
-		   UChar temp[16];
-		   const int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index);
-		   key.append(temp, len);
+		   char temp[16];
+		   const int32_t len = slprintf(temp, sizeof(temp), "%u", (uint32_t)num_index);
+		   key.append(UnicodeString(temp, len, US_INV));
 
 		   storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, num_index);
 		} else { //string; assumed to be in UTF-8