[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6

From: Date: Thu, 19 Nov 2026 23:29:34 +0000
Subject: [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143938@lists.php.net to get a copy of this message
Author: Ilia Alshanetsky (iliaal) Date: 2026-11-19T18:24:49-05:00 Commit: https://github.com/php/php-src/commit/6e071b5c8b65ae0acadf91f97eb4c228d9a513c1 Raw diff: https://github.com/php/php-src/commit/6e071b5c8b65ae0acadf91f97eb4c228d9a513c1.diff Merge branch 'PHP-8.5' into PHP-8.6 * PHP-8.5: ext/gettext: Fix refcount info for gettext(), dgettext(), dcgettext() Changed paths: A ext/gettext/tests/gh25584.phpt M NEWS M Zend/Optimizer/zend_func_infos.h M ext/gettext/gettext.stub.php M ext/gettext/gettext_arginfo.h Diff: diff --git a/NEWS b/NEWS index 1373d1249ca7..2b1d5c5c1d41 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,10 @@ PHP NEWS . Fixed stack overflow in filter_var() and filter_var_array() with deeply nested arrays. (Eyüp Can Akman) +- Gettext: + . Fixed bug GH-25584 (JIT frees the string returned by gettext(), + dgettext() or dcgettext() while it is still in use). (Ilia Alshanetsky) + - Intl: . Fixed NumberFormatter::getSymbol(), setSymbol(), getAttribute() and setAttribute() accepting out-of-range values that truncate to a valid one. diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index 0add5a32f911..a8c94cf891cd 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -146,9 +146,6 @@ static const func_info_t func_infos[] = { F1("imageaffinematrixconcat", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_DOUBLE|MAY_BE_FALSE), F1("imageresolution", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_TRUE), F1("textdomain", MAY_BE_STRING), - F1("gettext", MAY_BE_STRING), - F1("dgettext", MAY_BE_STRING), - F1("dcgettext", MAY_BE_STRING), F1("bindtextdomain", MAY_BE_STRING|MAY_BE_FALSE), #if defined(HAVE_NGETTEXT) F1("ngettext", MAY_BE_STRING), diff --git a/ext/gettext/gettext.stub.php b/ext/gettext/gettext.stub.php index 3e9a50177a59..7b89dabb7c41 100644 --- a/ext/gettext/gettext.stub.php +++ b/ext/gettext/gettext.stub.php @@ -5,16 +5,13 @@ /** @refcount 1 */ function textdomain(?string $domain = null): string {} -/** @refcount 1 */ function gettext(string $message): string {} /** @alias gettext */ function _(string $message): string {} -/** @refcount 1 */ function dgettext(string $domain, string $message): string {} -/** @refcount 1 */ function dcgettext(string $domain, string $message, int $category): string {} /** @refcount 1 */ diff --git a/ext/gettext/gettext_arginfo.h b/ext/gettext/gettext_arginfo.h index 8b622a322add..28d71f5ff1c0 100644 --- a/ext/gettext/gettext_arginfo.h +++ b/ext/gettext/gettext_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit gettext.stub.php instead. - * Stub hash: c675dc9492943bbac106c5906b75c31436964423 */ + * Stub hash: d2e9b8df0156e5b9f7e87f1b963530021d95d5f2 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_textdomain, 0, 0, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, domain, IS_STRING, 1, "null") diff --git a/ext/gettext/tests/gh25584.phpt b/ext/gettext/tests/gh25584.phpt new file mode 100644 index 000000000000..f9fbe4f2a0b3 --- /dev/null +++ b/ext/gettext/tests/gh25584.phpt @@ -0,0 +1,22 @@ +--TEST-- +GH-25584 (JIT frees the string returned by gettext(), dgettext() and dcgettext() while still referenced) +--EXTENSIONS-- +gettext +opcache +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=function +opcache.jit_buffer_size=64M +opcache.file_update_protection=0 +--FILE-- +<?php +$s = str_repeat("a", mt_rand(3, 3)); +gettext($s); +dgettext("x", $s); +dcgettext("x", $s, LC_CTYPE); +echo "msgid after calls: "; +var_dump($s); +?> +--EXPECT-- +msgid after calls: string(3) "aaa"

« previous php.cvs (#143938) next »