Commit b81f770d39e for php.net
commit b81f770d39e76b371bc19eb0e14abc96eaaea5f5
Merge: 006788b9ef0 10bbd9590b2
Author: Niels Dossche <7771979+ndossche@users.noreply.github.com>
Date: Mon Dec 22 12:18:14 2025 +0100
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
intl: Fix leak in umsg_format_helper()
diff --cc NEWS
index f6ce584b6e7,23ff95cee78..4c96bab8f52
--- a/NEWS
+++ b/NEWS
@@@ -15,10 -19,12 +15,13 @@@ PH
. Fixed bug GH-20722 (Null pointer dereference in DOM namespace node cloning
via clone on malformed objects). (ndossche)
-- GD:
- . Fixed bug GH-20622 (imagestring/imagestringup overflow). (David Carlier)
+- EXIF:
+ . Fixed bug GH-20631 (Integer underflow in exif HEIF parsing
+ when pos.size < 2). (Oblivionsage)
+ - Intl:
+ . Fix leak in umsg_format_helper(). (ndossche)
+
- LDAP:
. Fix memory leak in ldap_set_options(). (ndossche)
diff --cc ext/intl/msgformat/msgformat_helpers.cpp
index e734b2df27b,58e2a96bf23..25e8dbf8696
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@@ -455,7 -457,8 +455,8 @@@ U_CFUNC void umsg_format_helper(Message
char *message;
spprintf(&message, 0, "Invalid UTF-8 data in string argument: "
"'%s'", ZSTR_VAL(str));
+ zend_tmp_string_release(tmp_str);
- intl_errors_set(&err, err.code, message, 1);
+ intl_errors_set(&err, err.code, message);
efree(message);
delete text;
continue;
diff --cc ext/intl/tests/msgfmt_format_error4.phpt
index 451a55ad9da,b8ff3a0cd47..78dc27b4092
--- a/ext/intl/tests/msgfmt_format_error4.phpt
+++ b/ext/intl/tests/msgfmt_format_error4.phpt
@@@ -12,22 -11,22 +12,35 @@@ $fmt = <<<EO
EOD;
$mf = new MessageFormatter('en_US', $fmt);
-var_dump($mf->format(array("foo" => 7, "\x80" => "bar")));
+try {
+ var_dump($mf->format(array("foo" => 7, "\x80" => "bar")));
+} catch (Throwable $e) {
+ var_dump($e::class === 'IntlException');
+ var_dump("MessageFormatter::format(): Invalid UTF-8 data in argument key: '\x80'" === $e->getMessage());
+}
-var_dump($mf->format(array("foo" => "\x80")));
+try {
+ var_dump($mf->format(array("foo" => "\x80")));
+} catch (Throwable $e) {
+ var_dump($e::class === 'IntlException');
+ var_dump("MessageFormatter::format(): Invalid UTF-8 data in string argument: '\x80'" === $e->getMessage());
+}
+
-var_dump($mf->format(array("foo" => new class {
- function __toString(): string {
- return str_repeat("\x80", random_int(1, 1));
- }
-})));
++try {
++ var_dump($mf->format(array("foo" => new class {
++ function __toString(): string {
++ return str_repeat("\x80", random_int(1, 1));
++ }
++ })));
++} catch (Throwable $e) {
++ var_dump($e::class === 'IntlException');
++ var_dump("MessageFormatter::format(): Invalid UTF-8 data in string argument: '\x80'" === $e->getMessage());
++}
?>
---EXPECTF--
-bool(false)
-
-bool(false)
-
-bool(false)
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
++bool(true)
++bool(true)