[packages/php/PHP_7_1] Rel 30. Backport the 2026-11-19 PHP security fixes

arekm arekm at pld-linux.org
Thu Nov 19 18:53:25 CET 2026


commit 96fb5ca522b78de79ab9ed8d6edb345bd16aef1c
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Nov 19 18:35:41 2026 +0100

    Rel 30. Backport the 2026-11-19 PHP security fixes
    
    session.upload_progress.enabled now defaults to off, as upstream.
    
    Fixes CVE-2026-129538, CVE-2026-129506, CVE-2026-129496,
    CVE-2026-129481, CVE-2026-129474, CVE-2026-129292, CVE-2026-129291,
    CVE-2026-129289, CVE-2026-128090, CVE-2026-128064, CVE-2026-127960,
    CVE-2026-126714, CVE-2026-115560, CVE-2026-15353.

 php-cve-2026-115560.patch | 308 +++++++++++++++++++++++++++++++++++++++++++
 php-cve-2026-126714.patch |  32 +++++
 php-cve-2026-127960.patch | 185 ++++++++++++++++++++++++++
 php-cve-2026-128064.patch | 152 +++++++++++++++++++++
 php-cve-2026-128090.patch | 172 ++++++++++++++++++++++++
 php-cve-2026-129289.patch | 329 ++++++++++++++++++++++++++++++++++++++++++++++
 php-cve-2026-129291.patch |  50 +++++++
 php-cve-2026-129292.patch | 311 +++++++++++++++++++++++++++++++++++++++++++
 php-cve-2026-129474.patch | 175 ++++++++++++++++++++++++
 php-cve-2026-129481.patch | 121 +++++++++++++++++
 php-cve-2026-129496.patch |  84 ++++++++++++
 php-cve-2026-129506.patch |  72 ++++++++++
 php-cve-2026-129538.patch |  97 ++++++++++++++
 php-cve-2026-15353.patch  | 265 +++++++++++++++++++++++++++++++++++++
 php.spec                  |  30 ++++-
 15 files changed, 2382 insertions(+), 1 deletion(-)
---
diff --git a/php.spec b/php.spec
index 4b4f1e7..2c4f93a 100644
--- a/php.spec
+++ b/php.spec
@@ -151,7 +151,7 @@ Summary(ru.UTF-8):	PHP Версии 7 - язык препроцессирова
 Summary(uk.UTF-8):	PHP Версії 7 - мова препроцесування HTML-файлів, виконувана на сервері
 Name:		%{orgname}%{php_suffix}
 Version:	7.1.33
-Release:	29
+Release:	30
 Epoch:		4
 # All files licensed under PHP version 3.01, except
 # Zend is licensed under Zend
@@ -363,6 +363,20 @@ Patch322:	php-bug74604.patch
 Patch323:	php-bug76601.patch
 Patch324:	php-bug78680.patch
 Patch325:	php-bug77934.patch
+Patch326:	php-cve-2026-129538.patch
+Patch327:	php-cve-2026-129496.patch
+Patch328:	php-cve-2026-129289.patch
+Patch329:	php-cve-2026-129292.patch
+Patch330:	php-cve-2026-129291.patch
+Patch331:	php-cve-2026-128090.patch
+Patch332:	php-cve-2026-126714.patch
+Patch333:	php-cve-2026-115560.patch
+Patch334:	php-cve-2026-15353.patch
+Patch335:	php-cve-2026-129506.patch
+Patch336:	php-cve-2026-128064.patch
+Patch337:	php-cve-2026-127960.patch
+Patch338:	php-cve-2026-129474.patch
+Patch339:	php-cve-2026-129481.patch
 URL:		https://www.php.net/
 %{?with_interbase:%{!?with_interbase_inst:BuildRequires:	Firebird-devel >= 1.0.2.908-2}}
 %{?with_pspell:BuildRequires:	aspell-devel >= 2:0.50.0}
@@ -2323,6 +2337,20 @@ cp -p php.ini-production php.ini
 %patch -P323 -p1
 %patch -P324 -p1
 %patch -P325 -p1
+%patch -P326 -p1
+%patch -P327 -p1
+%patch -P328 -p1
+%patch -P329 -p1
+%patch -P330 -p1
+%patch -P331 -p1
+%patch -P332 -p1
+%patch -P333 -p1
+%patch -P334 -p1
+%patch -P335 -p1
+%patch -P336 -p1
+%patch -P337 -p1
+%patch -P338 -p1
+%patch -P339 -p1
 
 sed -E -i -e '1s,#!\s*/usr/bin/env\s+(.*),#!%{__bindir}\1,' \
       run-tests.php
diff --git a/php-cve-2026-115560.patch b/php-cve-2026-115560.patch
new file mode 100644
index 0000000..b8f8ff8
--- /dev/null
+++ b/php-cve-2026-115560.patch
@@ -0,0 +1,308 @@
+From: Arnaud Le Blanc <arnaud.lb at gmail.com>
+Date: Mon, 9 Nov 2026 12:02:32 +0100
+Subject: [PATCH] Fix GHSA-658j-r8rw-q6mx: session.upload_progress.enabled is off by default
+
+Also prevent changes to session INI settings at runtime when
+session.upload_progress.enabled is On.
+
+Backported to 7.1: most session settings use the generic OnUpdateLong/
+String/Bool handlers here (7.2 added the session wrappers with the
+active-session checks), so OnUpdateSessionLong/String/Bool wrappers are
+added with only the upload progress check, for the same settings 8.2
+guards; session.use_trans_sid keeps OnUpdateTransSid, which gets the
+check. The test uses get_class() instead of $e::class.
+
+Origin: backport, https://github.com/php/php-src/commit/3f70f66611583bca4ec18385f7f407e2808fa61f
+Bug: https://github.com/php/php-src/security/advisories/GHSA-658j-r8rw-q6mx
+---
+ ext/session/session.c                             |  68 ++++++++---
+ .../session_ini_set_upload_progress_enabled.phpt  | 125 ++++++++++++++++++++
+ 2 files changed, 177 insertions(+), 16 deletions(-)
+
+diff --git a/ext/session/session.c b/ext/session/session.c
+index 56356c81..eb9f16c1 100644
+--- a/ext/session/session.c
++++ b/ext/session/session.c
+@@ -94,6 +94,12 @@ zend_class_entry *php_session_update_timestamp_iface_entry;
+ 		return FAILURE;	\
+ 	}
+ 
++#define SESSION_CHECK_UPLOAD_PROGRESS_STATE \
++	if (PS(rfc1867_enabled) && stage == ZEND_INI_STAGE_RUNTIME) { \
++		zend_throw_error(NULL, "Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On");	\
++		return FAILURE;													\
++	}
++
+ #define APPLY_TRANS_SID (PS(use_trans_sid) && !PS(use_only_cookies))
+ 
+ static void php_session_send_cookie(void);
+@@ -523,6 +529,7 @@ static void php_session_normalize_vars() /* {{{ */
+ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
+ {
+ 	ps_module *tmp;
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 
+ 	tmp = _php_find_ps_module(ZSTR_VAL(new_value));
+@@ -553,6 +560,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
+ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
+ {
+ 	const ps_serializer *tmp;
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 
+ 	tmp = _php_find_ps_serializer(ZSTR_VAL(new_value));
+@@ -580,6 +588,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
+ 
+ static PHP_INI_MH(OnUpdateTransSid) /* {{{ */
+ {
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 
+ 	if (!strncasecmp(ZSTR_VAL(new_value), "on", sizeof("on"))) {
+@@ -594,6 +603,8 @@ static PHP_INI_MH(OnUpdateTransSid) /* {{{ */
+ 
+ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
+ {
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
++
+ 	/* Only do the safemode/open_basedir check at runtime */
+ 	if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) {
+ 		char *p;
+@@ -625,6 +636,8 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
+ 
+ static PHP_INI_MH(OnUpdateName) /* {{{ */
+ {
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
++
+ 	/* Numeric session.name won't work at all */
+ 	if ((!ZSTR_LEN(new_value) || is_numeric_string(ZSTR_VAL(new_value), ZSTR_LEN(new_value), NULL, NULL, 0))) {
+ 		int err_type;
+@@ -652,6 +665,7 @@ static PHP_INI_MH(OnUpdateSidLength) /* {{{ */
+ 	zend_long val;
+ 	char *endptr = NULL;
+ 
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	val = ZEND_STRTOL(ZSTR_VAL(new_value), &endptr, 10);
+ 	if (endptr && (*endptr == '\0')
+ 		&& val >= 22 && val <= PS_MAX_SID_LENGTH) {
+@@ -670,6 +684,7 @@ static PHP_INI_MH(OnUpdateSidBits) /* {{{ */
+ 	zend_long val;
+ 	char *endptr = NULL;
+ 
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	val = ZEND_STRTOL(ZSTR_VAL(new_value), &endptr, 10);
+ 	if (endptr && (*endptr == '\0')
+ 		&& val >= 4 && val <=6) {
+@@ -683,6 +698,26 @@ static PHP_INI_MH(OnUpdateSidBits) /* {{{ */
+ }
+ /* }}} */
+ 
++static PHP_INI_MH(OnUpdateSessionLong) /* {{{ */
++{
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
++	return OnUpdateLong(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
++}
++/* }}} */
++
++static PHP_INI_MH(OnUpdateSessionString) /* {{{ */
++{
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
++	return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
++}
++/* }}} */
++
++static PHP_INI_MH(OnUpdateSessionBool) /* {{{ */
++{
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
++	return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
++}
++/* }}} */
+ 
+ static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
+ {
+@@ -711,29 +746,29 @@ PHP_INI_BEGIN()
+ 	STD_PHP_INI_ENTRY("session.name",               "PHPSESSID", PHP_INI_ALL, OnUpdateName, session_name,       php_ps_globals,    ps_globals)
+ 	PHP_INI_ENTRY("session.save_handler",           "files",     PHP_INI_ALL, OnUpdateSaveHandler)
+ 	STD_PHP_INI_BOOLEAN("session.auto_start",       "0",         PHP_INI_PERDIR, OnUpdateBool,   auto_start,         php_ps_globals,    ps_globals)
+-	STD_PHP_INI_ENTRY("session.gc_probability",     "1",         PHP_INI_ALL, OnUpdateLong,   gc_probability,     php_ps_globals,    ps_globals)
+-	STD_PHP_INI_ENTRY("session.gc_divisor",         "100",       PHP_INI_ALL, OnUpdateLong,   gc_divisor,         php_ps_globals,    ps_globals)
+-	STD_PHP_INI_ENTRY("session.gc_maxlifetime",     "1440",      PHP_INI_ALL, OnUpdateLong,   gc_maxlifetime,     php_ps_globals,    ps_globals)
++	STD_PHP_INI_ENTRY("session.gc_probability",     "1",         PHP_INI_ALL, OnUpdateSessionLong, gc_probability,     php_ps_globals,    ps_globals)
++	STD_PHP_INI_ENTRY("session.gc_divisor",         "100",       PHP_INI_ALL, OnUpdateSessionLong, gc_divisor,         php_ps_globals,    ps_globals)
++	STD_PHP_INI_ENTRY("session.gc_maxlifetime",     "1440",      PHP_INI_ALL, OnUpdateSessionLong, gc_maxlifetime,     php_ps_globals,    ps_globals)
+ 	PHP_INI_ENTRY("session.serialize_handler",      "php",       PHP_INI_ALL, OnUpdateSerializer)
+-	STD_PHP_INI_ENTRY("session.cookie_lifetime",    "0",         PHP_INI_ALL, OnUpdateLong,   cookie_lifetime,    php_ps_globals,    ps_globals)
+-	STD_PHP_INI_ENTRY("session.cookie_path",        "/",         PHP_INI_ALL, OnUpdateString, cookie_path,        php_ps_globals,    ps_globals)
+-	STD_PHP_INI_ENTRY("session.cookie_domain",      "",          PHP_INI_ALL, OnUpdateString, cookie_domain,      php_ps_globals,    ps_globals)
+-	STD_PHP_INI_BOOLEAN("session.cookie_secure",    "",          PHP_INI_ALL, OnUpdateBool,   cookie_secure,      php_ps_globals,    ps_globals)
+-	STD_PHP_INI_BOOLEAN("session.cookie_httponly",  "",          PHP_INI_ALL, OnUpdateBool,   cookie_httponly,    php_ps_globals,    ps_globals)
+-	STD_PHP_INI_BOOLEAN("session.use_cookies",      "1",         PHP_INI_ALL, OnUpdateBool,   use_cookies,        php_ps_globals,    ps_globals)
+-	STD_PHP_INI_BOOLEAN("session.use_only_cookies", "1",         PHP_INI_ALL, OnUpdateBool,   use_only_cookies,   php_ps_globals,    ps_globals)
+-	STD_PHP_INI_BOOLEAN("session.use_strict_mode",  "0",         PHP_INI_ALL, OnUpdateBool,   use_strict_mode,    php_ps_globals,    ps_globals)
+-	STD_PHP_INI_ENTRY("session.referer_check",      "",          PHP_INI_ALL, OnUpdateString, extern_referer_chk, php_ps_globals,    ps_globals)
+-	STD_PHP_INI_ENTRY("session.cache_limiter",      "nocache",   PHP_INI_ALL, OnUpdateString, cache_limiter,      php_ps_globals,    ps_globals)
+-	STD_PHP_INI_ENTRY("session.cache_expire",       "180",       PHP_INI_ALL, OnUpdateLong,   cache_expire,       php_ps_globals,    ps_globals)
++	STD_PHP_INI_ENTRY("session.cookie_lifetime",    "0",         PHP_INI_ALL, OnUpdateSessionLong, cookie_lifetime,    php_ps_globals,    ps_globals)
++	STD_PHP_INI_ENTRY("session.cookie_path",        "/",         PHP_INI_ALL, OnUpdateSessionString, cookie_path,        php_ps_globals,    ps_globals)
++	STD_PHP_INI_ENTRY("session.cookie_domain",      "",          PHP_INI_ALL, OnUpdateSessionString, cookie_domain,      php_ps_globals,    ps_globals)
++	STD_PHP_INI_BOOLEAN("session.cookie_secure",    "",          PHP_INI_ALL, OnUpdateSessionBool, cookie_secure,      php_ps_globals,    ps_globals)
++	STD_PHP_INI_BOOLEAN("session.cookie_httponly",  "",          PHP_INI_ALL, OnUpdateSessionBool, cookie_httponly,    php_ps_globals,    ps_globals)
++	STD_PHP_INI_BOOLEAN("session.use_cookies",      "1",         PHP_INI_ALL, OnUpdateSessionBool, use_cookies,        php_ps_globals,    ps_globals)
++	STD_PHP_INI_BOOLEAN("session.use_only_cookies", "1",         PHP_INI_ALL, OnUpdateSessionBool, use_only_cookies,   php_ps_globals,    ps_globals)
++	STD_PHP_INI_BOOLEAN("session.use_strict_mode",  "0",         PHP_INI_ALL, OnUpdateSessionBool, use_strict_mode,    php_ps_globals,    ps_globals)
++	STD_PHP_INI_ENTRY("session.referer_check",      "",          PHP_INI_ALL, OnUpdateSessionString, extern_referer_chk, php_ps_globals,    ps_globals)
++	STD_PHP_INI_ENTRY("session.cache_limiter",      "nocache",   PHP_INI_ALL, OnUpdateSessionString, cache_limiter,      php_ps_globals,    ps_globals)
++	STD_PHP_INI_ENTRY("session.cache_expire",       "180",       PHP_INI_ALL, OnUpdateSessionLong, cache_expire,       php_ps_globals,    ps_globals)
+ 	PHP_INI_ENTRY("session.use_trans_sid",          "0",         PHP_INI_ALL, OnUpdateTransSid)
+ 	PHP_INI_ENTRY("session.sid_length",             "32",        PHP_INI_ALL, OnUpdateSidLength)
+ 	PHP_INI_ENTRY("session.sid_bits_per_character", "4",         PHP_INI_ALL, OnUpdateSidBits)
+-	STD_PHP_INI_BOOLEAN("session.lazy_write",       "1",         PHP_INI_ALL, OnUpdateBool,   lazy_write,         php_ps_globals,    ps_globals)
++	STD_PHP_INI_BOOLEAN("session.lazy_write",       "1",         PHP_INI_ALL, OnUpdateSessionBool, lazy_write,         php_ps_globals,    ps_globals)
+ 
+ 	/* Upload progress */
+ 	STD_PHP_INI_BOOLEAN("session.upload_progress.enabled",
+-	                                                "1",     ZEND_INI_PERDIR, OnUpdateBool,        rfc1867_enabled, php_ps_globals, ps_globals)
++	                                                "0",     ZEND_INI_PERDIR, OnUpdateBool,        rfc1867_enabled, php_ps_globals, ps_globals)
+ 	STD_PHP_INI_BOOLEAN("session.upload_progress.cleanup",
+ 	                                                "1",     ZEND_INI_PERDIR, OnUpdateBool,        rfc1867_cleanup, php_ps_globals, ps_globals)
+ 	STD_PHP_INI_ENTRY("session.upload_progress.prefix",
+@@ -2635,6 +2670,7 @@ static PHP_GINIT_FUNCTION(ps) /* {{{ */
+ 	ps_globals->mod_user_is_open = 0;
+ 	ps_globals->session_vars = NULL;
+ 	ps_globals->in_rfc1867_update = 0;
++	ps_globals->rfc1867_enabled = 0;
+ 	for (i = 0; i < PS_NUM_APIS; i++) {
+ 		ZVAL_UNDEF(&ps_globals->mod_user_names.names[i]);
+ 	}
+diff --git a/ext/session/tests/session_ini_set_upload_progress_enabled.phpt b/ext/session/tests/session_ini_set_upload_progress_enabled.phpt
+new file mode 100644
+index 00000000..a29d72b8
+--- /dev/null
++++ b/ext/session/tests/session_ini_set_upload_progress_enabled.phpt
+@@ -0,0 +1,125 @@
++--TEST--
++ini_set() for session.* is not allowed when session.upload_progress.enabled is On
++--SKIPIF--
++<?php include('skipif.inc'); ?>
++--INI--
++session.upload_progress.enabled=1
++session.save_path=
++session.name=NOTPHPSESSID
++session.save_handler=files
++session.serialize_handler=php_serialize
++session.cookie_lifetime=42
++session.gc_probability=2
++session.cookie_path=/startup
++session.cookie_secure=1
++session.sid_length=40
++session.sid_bits_per_character=5
++--FILE--
++<?php
++/* The INI section above is applied at the startup stage, so these values must
++ * have been applied even though session.upload_progress.enabled is On. */
++echo "*** Settings applied at startup ***\n";
++foreach ([
++    "session.name",
++    "session.serialize_handler",
++    "session.cookie_lifetime",
++    "session.gc_probability",
++    "session.cookie_path",
++    "session.cookie_secure",
++    "session.sid_length",
++    "session.sid_bits_per_character",
++] as $name) {
++    printf("%s=%s\n", $name, var_export(ini_get($name), true));
++}
++
++echo "\n*** ini_set() is rejected at runtime ***\n";
++
++function try_ini_set($name, $value) {
++    try {
++        var_dump(ini_set($name, $value));
++    } catch (\Throwable $e) {
++        echo get_class($e), ": ", $e->getMessage(), "\n";
++    }
++}
++
++/* One entry per ini modify handler guarded by the check. */
++try_ini_set("session.save_path", "/tmp");
++try_ini_set("session.name", "PHPSESSID");
++try_ini_set("session.save_handler", "user");
++try_ini_set("session.serialize_handler", "php");
++try_ini_set("session.cookie_lifetime", "1");
++try_ini_set("session.gc_probability", "1");
++try_ini_set("session.cookie_path", "/runtime");
++try_ini_set("session.cookie_secure", "0");
++try_ini_set("session.sid_length", "32");
++try_ini_set("session.sid_bits_per_character", "4");
++
++echo "\n*** ini_restore() is rejected at runtime ***\n";
++try {
++    var_dump(ini_restore("session.name"));
++} catch (\Throwable $e) {
++    echo get_class($e), ": ", $e->getMessage(), "\n";
++}
++var_dump(ini_get("session.name"));
++
++echo "\n*** Values are unchanged ***\n";
++foreach ([
++    "session.name",
++    "session.serialize_handler",
++    "session.cookie_lifetime",
++    "session.gc_probability",
++    "session.cookie_path",
++    "session.cookie_secure",
++    "session.sid_length",
++    "session.sid_bits_per_character",
++] as $name) {
++    printf("%s=%s\n", $name, var_export(ini_get($name), true));
++}
++
++echo "\n*** Non-session ini settings are unaffected ***\n";
++var_dump(ini_set("precision", "10"));
++var_dump(ini_get("precision"));
++
++echo "Done\n";
++?>
++--EXPECT--
++*** Settings applied at startup ***
++session.name='NOTPHPSESSID'
++session.serialize_handler='php_serialize'
++session.cookie_lifetime='42'
++session.gc_probability='2'
++session.cookie_path='/startup'
++session.cookie_secure='1'
++session.sid_length='40'
++session.sid_bits_per_character='5'
++
++*** ini_set() is rejected at runtime ***
++Error: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Error: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Error: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Error: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Error: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Error: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Error: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Error: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Error: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Error: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++
++*** ini_restore() is rejected at runtime ***
++Error: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++string(12) "NOTPHPSESSID"
++
++*** Values are unchanged ***
++session.name='NOTPHPSESSID'
++session.serialize_handler='php_serialize'
++session.cookie_lifetime='42'
++session.gc_probability='2'
++session.cookie_path='/startup'
++session.cookie_secure='1'
++session.sid_length='40'
++session.sid_bits_per_character='5'
++
++*** Non-session ini settings are unaffected ***
++string(2) "14"
++string(2) "10"
++Done
diff --git a/php-cve-2026-126714.patch b/php-cve-2026-126714.patch
new file mode 100644
index 0000000..bc1886e
--- /dev/null
+++ b/php-cve-2026-126714.patch
@@ -0,0 +1,32 @@
+From: Ilija Tovilo <ilija.tovilo at me.com>
+Date: Wed, 11 Nov 2026 16:53:47 +0100
+Subject: [PATCH] Fix GHSA-fm2m-fjf5-v3cp: RCE via corrupted session file
+
+If the session write is interrupted, and the previous session file wasn't
+truncated, we can end up with two partial sessions concatenated together. The
+approximate location of failure may be attacker-controllable in threaded
+environments if another thread causes the process to _exit().
+
+Origin: upstream, https://github.com/php/php-src/commit/41c0941ae27d1033129e0e09ce3af034ffee86ba
+Bug: https://github.com/php/php-src/security/advisories/GHSA-fm2m-fjf5-v3cp
+---
+ ext/session/mod_files.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
+index 0a450148..34f1f546 100644
+--- a/ext/session/mod_files.c
++++ b/ext/session/mod_files.c
+@@ -240,9 +240,9 @@ static int ps_files_write(ps_files *data, zend_string *key, zend_string *val)
+ 		return FAILURE;
+ 	}
+ 
+-	/* Truncate file if the amount of new data is smaller than the existing data set. */
+-	if (ZSTR_LEN(val) < data->st_size) {
+-		php_ignore_value(ftruncate(data->fd, 0));
++	if (ftruncate(data->fd, 0) != 0) {
++		php_error_docref(NULL, E_WARNING, "ftruncate() failed: %s (%d)", strerror(errno), errno);
++		return FAILURE;
+ 	}
+ 
+ #if defined(HAVE_PWRITE)
diff --git a/php-cve-2026-127960.patch b/php-cve-2026-127960.patch
new file mode 100644
index 0000000..9b00757
--- /dev/null
+++ b/php-cve-2026-127960.patch
@@ -0,0 +1,185 @@
+From: Jakub Zelenka <bukka at php.net>
+Date: Tue, 6 Oct 2026 15:29:19 +0200
+Subject: [PATCH] Fix GHSA-mmf9-xm3v-hg2x: quadratic folded header concatenation
+
+Each folded response header line was concatenated with the whole
+accumulated header value into a newly allocated string. That made
+parsing of a header split into many continuation lines quadratic, so a
+malicious server could stall the client for a long time with a few MB
+of headers.
+
+Accumulate the last header line in a smart_str instead so folding is
+linear in the total header size.
+
+Backported to 7.1 on top of php-cve-2025-1217.patch: no smart_str_extract()
+here, the string is taken out of the smart_str by hand.
+
+Origin: backport, https://github.com/php/php-src/commit/a303f697268d42f6671c9d4c479ff90bbf301db1
+Bug: https://github.com/php/php-src/security/advisories/GHSA-mmf9-xm3v-hg2x
+---
+ ext/standard/http_fopen_wrapper.c | 64 ++++++++++++++++++-------------------
+ 1 file changed, 31 insertions(+), 33 deletions(-)
+
+diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
+index 7598629f..ab62f6bf 100644
+--- a/ext/standard/http_fopen_wrapper.c
++++ b/ext/standard/http_fopen_wrapper.c
+@@ -211,25 +211,21 @@ static zend_bool php_stream_http_response_header_trim(char *http_header_line,
+ }
+ 
+ /* Process folding headers of the current line and if there are none, parse last full response
+- * header line. It returns NULL if the last header is finished, otherwise it returns updated
+- * last header line.  */
+-static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *wrapper,
++ * header line. It returns true if the current line was folded into the last header line,
++ * otherwise false.  */
++static zend_bool php_stream_http_response_headers_parse(php_stream_wrapper *wrapper,
+ 		php_stream *stream, php_stream_context *context, int options,
+-		zend_string *last_header_line_str, char *header_line, size_t *header_line_length,
++		smart_str *last_header, char *header_line, size_t *header_line_length,
+ 		int response_code, zval *response_header,
+ 		php_stream_http_response_header_info *header_info)
+ {
+-	char *last_header_line = ZSTR_VAL(last_header_line_str);
+-	size_t last_header_line_length = ZSTR_LEN(last_header_line_str);
+-	char *last_header_line_end = ZSTR_VAL(last_header_line_str) + ZSTR_LEN(last_header_line_str) - 1;
+-
+ 	/* Process non empty header line. */
+ 	if (header_line && (*header_line != '\n' && *header_line != '\r')) {
+ 		/* Removing trailing white spaces. */
+ 		if (php_stream_http_response_header_trim(header_line, header_line_length) &&
+ 				*header_line_length == 0) {
+ 			/* Only spaces so treat as an empty folding header. */
+-			return last_header_line_str;
++			return 1;
+ 		}
+ 
+ 		/* Process folding headers if starting with a space or a tab. */
+@@ -244,20 +240,21 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w
+ 			/* It has to have some characters because it would get returned after the call
+ 			 * php_stream_http_response_header_trim above. */
+ 			ZEND_ASSERT(http_folded_header_line_length > 0);
+-			/* Concatenate last header line, space and current header line. */
+-			size_t len = last_header_line_length + 1 + http_folded_header_line_length;
+-			zend_string *extended_header_str = zend_string_alloc(len, 0);
+-			memcpy(ZSTR_VAL(extended_header_str), last_header_line, last_header_line_length);
+-			ZSTR_VAL(extended_header_str)[last_header_line_length] = ' ';
+-			memcpy(ZSTR_VAL(extended_header_str) + last_header_line_length + 1, http_folded_header_line, http_folded_header_line_length);
+-			ZSTR_VAL(extended_header_str)[len] = '\0';
+-			zend_string_free(last_header_line_str);
+-			last_header_line_str = extended_header_str;
+-			/* Return new header line. */
+-			return last_header_line_str;
++			/* Append space and current header line to the last header line. */
++			smart_str_appendc(last_header, ' ');
++			smart_str_appendl(last_header, http_folded_header_line, http_folded_header_line_length);
++			return 1;
+ 		}
+ 	}
+ 
++	smart_str_0(last_header);
++	zend_string *last_header_line_str = last_header->s;
++	last_header->s = NULL;
++	last_header->a = 0;
++	char *last_header_line = ZSTR_VAL(last_header_line_str);
++	size_t last_header_line_length = ZSTR_LEN(last_header_line_str);
++	char *last_header_line_end = ZSTR_VAL(last_header_line_str) + ZSTR_LEN(last_header_line_str) - 1;
++
+ 	/* Find header separator position. */
+ 	char *last_header_value = memchr(last_header_line, ':', last_header_line_length);
+ 	if (last_header_value) {
+@@ -269,7 +266,7 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w
+ 				php_stream_wrapper_log_error(wrapper, options,
+ 					"HTTP invalid response format (space in header name)!");
+ 				zend_string_free(last_header_line_str);
+-				return NULL;
++				return 0;
+ 			}
+ 			++last_header_name;
+ 		}
+@@ -287,7 +284,7 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w
+ 		php_stream_wrapper_log_error(wrapper, options,
+ 				"HTTP invalid response format (no colon in header line)!");
+ 		zend_string_free(last_header_line_str);
+-		return NULL;
++		return 0;
+ 	}
+ 
+ 	zend_bool store_header = 1;
+@@ -312,7 +309,7 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w
+ 					"HTTP Location header size is over the limit of %d bytes",
+ 					HTTP_HEADER_MAX_LOCATION_SIZE);
+ 			zend_string_free(last_header_line_str);
+-			return NULL;
++			return 0;
+ 		}
+ 		if (header_info->location_len == 0) {
+ 			header_info->location = emalloc(last_header_value_len + 1);
+@@ -360,7 +357,7 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w
+ 		zend_string_free(last_header_line_str);
+ 	}
+ 
+-	return NULL;
++	return 0;
+ }
+ 
+ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
+@@ -377,7 +374,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
+ 	zval response_header;
+ 	int reqok = 0;
+ 	char *http_header_line = NULL;
+-	zend_string *last_header_line_str = NULL;
++	smart_str last_header = {0};
+ 	php_stream_http_response_header_info header_info;
+ 	char tmp_line[128];
+ 	size_t chunk_size = 0;
+@@ -1035,12 +1032,12 @@ finish:
+ 				last_line = 0;
+ 			}
+ 			
+-			if (last_header_line_str != NULL) {
++			if (last_header.s != NULL) {
+ 				/* Parse last header line. */
+-				last_header_line_str = php_stream_http_response_headers_parse(wrapper, stream,
+-						context, options, last_header_line_str, http_header_line,
++				zend_bool folded = php_stream_http_response_headers_parse(wrapper, stream,
++						context, options, &last_header, http_header_line,
+ 						&http_header_line_length, response_code, &response_header, &header_info);
+-				if (EXPECTED(last_header_line_str == NULL)) {
++				if (EXPECTED(!folded)) {
+ 					if (UNEXPECTED(header_info.error)) {
+ 						php_stream_close(stream);
+ 						stream = NULL;
+@@ -1064,20 +1061,20 @@ finish:
+ 			}
+ 			if (last_line) {
+ 				/* For the last line the last header line must be NULL. */
+-				ZEND_ASSERT(last_header_line_str == NULL);
++				ZEND_ASSERT(last_header.s == NULL);
+ 				break;
+ 			}
+ 			/* Save current line as the last line so it gets parsed in the next round. */
+-			last_header_line_str = zend_string_init(http_header_line, http_header_line_length, 0);
++			smart_str_appendl(&last_header, http_header_line, http_header_line_length);
+ 		} else {
+ 			break;
+ 		}
+ 	}
+ 
+ 	/* If the stream was closed early, we still want to process the last line to keep BC. */
+-	if (last_header_line_str != NULL) {
++	if (last_header.s != NULL) {
+ 		php_stream_http_response_headers_parse(wrapper, stream, context, options,
+-				last_header_line_str, NULL, NULL, response_code, &response_header, &header_info);
++				&last_header, NULL, NULL, response_code, &response_header, &header_info);
+ 	}
+ 
+ 	if (!reqok || (header_info.location != NULL && header_info.follow_location)) {
+@@ -1199,6 +1196,7 @@ finish:
+ out:
+ 
+ 	smart_str_free(&req_buf);
++	smart_str_free(&last_header);
+ 
+ 	if (http_header_line) {
+ 		efree(http_header_line);
diff --git a/php-cve-2026-128064.patch b/php-cve-2026-128064.patch
new file mode 100644
index 0000000..42b8d12
--- /dev/null
+++ b/php-cve-2026-128064.patch
@@ -0,0 +1,152 @@
+From: Jakub Zelenka <bukka at php.net>
+Date: Fri, 6 Nov 2026 21:46:18 +0100
+Subject: [PATCH] Fix GHSA-f6gg-rchx-xw8j: mixed case HTTPS and FTPS
+
+Determine TLS use from a case-insensitive comparison of the complete
+URL scheme, preventing mixed-case HTTPS and FTPS URLs from downgrading
+to plaintext. Add regression tests for both wrappers.
+
+Backported to 7.1: the scheme is a char * here; the tests use
+ServerClientTestCase-8.1.inc (php-tests-openssl-server-8.1.patch) and
+no named arguments.
+
+Origin: backport, https://github.com/php/php-src/commit/cb68a63e8177f9dc25aba23c0d79c7da82ea69db
+Bug: https://github.com/php/php-src/security/advisories/GHSA-f6gg-rchx-xw8j
+---
+ ext/standard/ftp_fopen_wrapper.c                  |  2 +-
+ ext/standard/http_fopen_wrapper.c                 |  2 +-
+ ext/standard/tests/http/ghsa-f6gg-rchx-xw8j.phpt  | 60 +++++++++++++++++++++
+ .../tests/streams/ghsa-f6gg-rchx-xw8j.phpt        | 33 ++++++++++++
+ 4 files changed, 95 insertions(+), 2 deletions(-)
+
+diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
+index f85fe3ab..a3de15e7 100644
+--- a/ext/standard/ftp_fopen_wrapper.c
++++ b/ext/standard/ftp_fopen_wrapper.c
+@@ -150,7 +150,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char
+ 		return NULL;
+ 	}
+ 
+-	use_ssl = resource->scheme && (strlen(resource->scheme) > 3) && resource->scheme[3] == 's';
++	use_ssl = resource->scheme && !strcasecmp(resource->scheme, "ftps");
+ 
+ 	/* use port 21 if one wasn't specified */
+ 	if (resource->port == 0)
+diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
+index 5509ec26..7598629f 100644
+--- a/ext/standard/http_fopen_wrapper.c
++++ b/ext/standard/http_fopen_wrapper.c
+@@ -439,7 +439,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
+ 			request_fulluri = zend_is_true(tmpzval);
+ 		}
+ 
+-		use_ssl = resource->scheme && (strlen(resource->scheme) > 4) && resource->scheme[4] == 's';
++		use_ssl = resource->scheme && !strcasecmp(resource->scheme, "https");
+ 		/* choose default ports */
+ 		if (use_ssl && resource->port == 0)
+ 			resource->port = 443;
+diff --git a/ext/standard/tests/http/ghsa-f6gg-rchx-xw8j.phpt b/ext/standard/tests/http/ghsa-f6gg-rchx-xw8j.phpt
+new file mode 100644
+index 00000000..32649d3d
+--- /dev/null
++++ b/ext/standard/tests/http/ghsa-f6gg-rchx-xw8j.phpt
+@@ -0,0 +1,60 @@
++--TEST--
++GHSA-f6gg-rchx-xw8j: mixed-case HTTPS URLs must use TLS
++--SKIPIF--
++<?php
++if (!extension_loaded('openssl')) die('skip openssl extension required');
++if (!function_exists('proc_open')) die('skip proc_open() not available');
++?>
++--FILE--
++<?php
++$serverCode = <<<'CODE'
++    $server = stream_socket_server('tcp://127.0.0.1:0', $errno, $errstr);
++    phpt_notify_server_start($server);
++
++    $conn = stream_socket_accept($server);
++    $request = fread($conn, 1);
++
++    if ($request === "\x16") {
++        $result = 'TLS';
++    } else {
++        while (($line = stream_get_line($conn, 8192, "\r\n")) !== false) {
++            $request .= $line . "\r\n";
++            if ($line === '') {
++                break;
++            }
++        }
++        $request .= stream_get_contents($conn, strlen('opensec-sensitive-body'));
++        $result = strpos($request, 'Authorization: Basic ') !== false
++            && strpos($request, 'X-Opensec-Request: validation') !== false
++            && strpos($request, 'opensec-sensitive-body') !== false
++                ? 'plaintext credentials and body'
++                : 'unexpected plaintext request';
++    }
++
++    fclose($conn);
++    fclose($server);
++    phpt_notify(WORKER_DEFAULT_NAME, $result);
++CODE;
++
++$clientCode = <<<'CODE'
++    $context = stream_context_create([
++        'http' => [
++            'method' => 'POST',
++            'content' => 'opensec-sensitive-body',
++            'header' => "X-Opensec-Request: validation\r\n",
++        ],
++        'ssl' => [
++            'verify_peer' => false,
++            'verify_peer_name' => false,
++        ],
++    ]);
++    var_dump(@file_get_contents('HTTPS://alice:secret@{{ ADDR }}/secret', false, $context));
++    echo phpt_wait();
++CODE;
++
++include sprintf('%s/../../../openssl/tests/ServerClientTestCase-8.1.inc', __DIR__);
++ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
++?>
++--EXPECT--
++bool(false)
++TLS
+diff --git a/ext/standard/tests/streams/ghsa-f6gg-rchx-xw8j.phpt b/ext/standard/tests/streams/ghsa-f6gg-rchx-xw8j.phpt
+new file mode 100644
+index 00000000..9035badf
+--- /dev/null
++++ b/ext/standard/tests/streams/ghsa-f6gg-rchx-xw8j.phpt
+@@ -0,0 +1,33 @@
++--TEST--
++GHSA-f6gg-rchx-xw8j: mixed-case FTPS URLs must enable TLS
++--SKIPIF--
++<?php
++if (!extension_loaded('openssl')) die('skip openssl extension required');
++if (!function_exists('proc_open')) die('skip proc_open() not available');
++?>
++--FILE--
++<?php
++$serverCode = <<<'CODE'
++    $server = stream_socket_server('tcp://127.0.0.1:0', $errno, $errstr);
++    phpt_notify_server_start($server);
++
++    $conn = stream_socket_accept($server);
++    fwrite($conn, "220 Ready\r\n");
++    $command = stream_get_line($conn, 8192, "\r\n");
++
++    fclose($conn);
++    fclose($server);
++    phpt_notify(WORKER_DEFAULT_NAME, $command);
++CODE;
++
++$clientCode = <<<'CODE'
++    var_dump(@fopen('FTPS://{{ ADDR }}/secret', 'r'));
++    echo phpt_wait();
++CODE;
++
++include sprintf('%s/../../../openssl/tests/ServerClientTestCase-8.1.inc', __DIR__);
++ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
++?>
++--EXPECT--
++bool(false)
++AUTH TLS
diff --git a/php-cve-2026-128090.patch b/php-cve-2026-128090.patch
new file mode 100644
index 0000000..f278dc6
--- /dev/null
+++ b/php-cve-2026-128090.patch
@@ -0,0 +1,172 @@
+From: Alexandre Daubois <alex.daubois at gmail.com>
+Date: Fri, 13 Nov 2026 08:33:23 +0100
+Subject: [PATCH] Fix GHSA-68fq-fh7h-f8gr: refuse keyless phar signature when .pubkey exists
+
+The signature type is not covered by the signature, so an OpenSSL signed
+phar could be downgraded to a keyless hash algorithm.
+
+Backported to 7.1: PHAR_SIG_OPENSSL is the only OpenSSL signature type
+(no OPENSSL_SHA256/512); SKIPIF instead of --EXTENSIONS--.
+
+Origin: backport, https://github.com/php/php-src/commit/7050cf338092a93e7d4caa4b7dc0bb8771f52a01
+Bug: https://github.com/php/php-src/security/advisories/GHSA-68fq-fh7h-f8gr
+---
+ ext/phar/tests/ghsa-68fq-fh7h-f8gr.phpt | 121 ++++++++++++++++++++++++++++++
+ ext/phar/util.c                         |  17 +++++
+ 2 files changed, 138 insertions(+)
+
+diff --git a/ext/phar/tests/ghsa-68fq-fh7h-f8gr.phpt b/ext/phar/tests/ghsa-68fq-fh7h-f8gr.phpt
+new file mode 100644
+index 00000000..0e80e325
+--- /dev/null
++++ b/ext/phar/tests/ghsa-68fq-fh7h-f8gr.phpt
+@@ -0,0 +1,121 @@
++--TEST--
++GHSA-68fq-fh7h-f8gr (OpenSSL signature bypass by downgrading the algorithm to a keyless one)
++--SKIPIF--
++<?php
++if (!extension_loaded("phar")) die("skip phar extension required");
++if (!extension_loaded("openssl")) die("skip openssl extension required");
++if (!in_array("OpenSSL", Phar::getSupportedSignatures())) die("skip openssl support required");
++?>
++--INI--
++phar.readonly=0
++phar.require_hash=1
++--FILE--
++<?php
++$base = __DIR__ . '/' . basename(__FILE__, '.php');
++$private = openssl_pkey_get_private(file_get_contents(__DIR__ . '/files/private.pem'));
++$pkey = '';
++openssl_pkey_export($private, $pkey, null, ['config' => __DIR__ . '/files/openssl.cnf']);
++$pubkey = openssl_pkey_get_details($private)['key'];
++
++function build(string $file, string $pkey): string
++{
++    $phar = new Phar($file);
++    $phar['main.php'] = '<?php echo "GENUINE\n";';
++    $phar->setStub('<?php __HALT_COMPILER();');
++    $phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey);
++
++    return file_get_contents($file);
++}
++
++// a phar built in this process comes back from the cache, so each case is read under its own name
++function open(string $file, string $archive, ?string $pubkey): void
++{
++    file_put_contents($file, $archive);
++    if ($pubkey !== null) {
++        file_put_contents($file . '.pubkey', $pubkey);
++    }
++
++    try {
++        echo (new Phar($file))->getSignature()['hash_type'], "\n";
++    } catch (UnexpectedValueException $e) {
++        echo $e->getMessage(), "\n";
++    }
++}
++
++function downgrade_phar(string $archive): string
++{
++    // the last 12 bytes are [length][algorithm]["GBMB"], the signature sits just before them
++    $siglen = unpack('V', substr($archive, -12, 4))[1];
++    $message = substr($archive, 0, strlen($archive) - 12 - $siglen);
++
++    return $message . hash('sha256', $message, true) . pack('V', 0x0003) . 'GBMB'; // 0x0003 is PHAR_SIG_SHA256
++}
++
++function downgrade_tar(string $archive): string
++{
++    for ($offset = 0; $offset + 512 <= strlen($archive); ) {
++        $size = (int) octdec(trim(substr($archive, $offset + 124, 12), " \0")); // octal size field of a 512 byte header
++
++        if (rtrim(substr($archive, $offset, 100), "\0") === '.phar/signature.bin') {
++            // the signed message stops at this header, so rewriting the entry content leaves it alone
++            $blob = pack('VV', 0x0003, 32) . hash('sha256', substr($archive, 0, $offset), true); // [algorithm][digest length][digest]
++
++            return substr_replace($archive, str_pad($blob, $size, "\0"), $offset + 512, $size);
++        }
++
++        $offset += 512 + (($size + 511) & ~511);
++    }
++
++    throw new RuntimeException('no signature entry');
++}
++
++function downgrade_zip(string $archive): string
++{
++    $eocd = strrpos($archive, "PK\x05\x06");
++    $cdir = unpack('V', substr($archive, $eocd + 16, 4))[1]; // the eocd holds the directory offset at +16 and the archive comment length at +20
++    $comment = substr($archive, $eocd + 22, unpack('v', substr($archive, $eocd + 20, 2))[1]);
++
++    for ($record = $cdir; substr($archive, $record, 4) === "PK\x01\x02"; ) {
++        $namelen = unpack('v', substr($archive, $record + 28, 2))[1];
++
++        if (substr($archive, $record + 46, $namelen) === '.phar/signature.bin') {
++            $size = unpack('V', substr($archive, $record + 24, 4))[1];
++            $local = unpack('V', substr($archive, $record + 42, 4))[1];
++            $content = $local + 30 + unpack('v', substr($archive, $local + 26, 2))[1] + unpack('v', substr($archive, $local + 28, 2))[1];
++            // the signed message is everything before the local entry plus the directory up to this record
++            $message = substr($archive, 0, $local) . substr($archive, $cdir, $record - $cdir) . $comment;
++            $blob = pack('VV', 0x0003, 32) . hash('sha256', $message, true);
++
++            return substr_replace($archive, str_pad($blob, $size, "\0"), $content, $size);
++        }
++
++        $record += 46 + $namelen + unpack('v', substr($archive, $record + 30, 2))[1] + unpack('v', substr($archive, $record + 32, 2))[1];
++    }
++
++    throw new RuntimeException('no signature entry');
++}
++
++foreach (['phar' => 'downgrade_phar', 'phar.tar' => 'downgrade_tar', 'phar.zip' => 'downgrade_zip'] as $suffix => $downgrade) {
++    $archive = build($base . '.source.' . $suffix, $pkey);
++    open($base . '.signed.' . $suffix, $archive, $pubkey);
++    open($base . '.tampered.' . $suffix, $downgrade($archive), $pubkey);
++    open($base . '.nokey.' . $suffix, $downgrade($archive), null);
++}
++?>
++--CLEAN--
++<?php
++$base = __DIR__ . '/' . basename(__FILE__, '.clean.php');
++foreach (glob($base . '.*.phar*') as $file) {
++    unlink($file);
++}
++?>
++--EXPECTF--
++OpenSSL
++phar "%stampered.phar" SHA256 signature could not be verified: openssl public key found, but the signature does not use openssl
++SHA-256
++OpenSSL
++phar error: tar-based phar "%stampered.phar.tar" signature cannot be verified: openssl public key found, but the signature does not use openssl
++SHA-256
++OpenSSL
++phar error: signature cannot be verified: openssl public key found, but the signature does not use openssl in zip-based phar "%stampered.phar.zip"
++SHA-256
+diff --git a/ext/phar/util.c b/ext/phar/util.c
+index 5c273166..0d7f07ab 100644
+--- a/ext/phar/util.c
++++ b/ext/phar/util.c
+@@ -1510,6 +1510,23 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, uint32_t sig_type,
+ 
+ 	php_stream_rewind(fp);
+ 
++	if (sig_type != PHAR_SIG_OPENSSL) {
++		php_stream_statbuf ssb;
++		char *pfile;
++		zend_bool has_pubkey;
++
++		spprintf(&pfile, 0, "%s.pubkey", fname);
++		has_pubkey = php_stream_stat_path_ex(pfile, PHP_STREAM_URL_STAT_QUIET, &ssb, NULL) == 0;
++		efree(pfile);
++
++		if (has_pubkey) {
++			if (error) {
++				spprintf(error, 0, "openssl public key found, but the signature does not use openssl");
++			}
++			return FAILURE;
++		}
++	}
++
+ 	switch (sig_type) {
+ 		case PHAR_SIG_OPENSSL: {
+ #ifdef PHAR_HAVE_OPENSSL
diff --git a/php-cve-2026-129289.patch b/php-cve-2026-129289.patch
new file mode 100644
index 0000000..01653e1
--- /dev/null
+++ b/php-cve-2026-129289.patch
@@ -0,0 +1,329 @@
+From: Jakub Zelenka <bukka at php.net>
+Date: Thu, 29 Oct 2026 11:19:04 +0100
+Subject: [PATCH] Fix GHSA-qc49-hpvq-g2w6: Drain unread request bodies
+
+Opening php://input can create a request body stream without
+consuming the input from the SAPI. Request shutdown treated the
+stream as proof that the body was read and skipped the drain.
+
+Drain whenever post_read is false, independently of whether the
+stream exists. This keeps unread FastCGI STDIN bytes from being
+parsed as another request when FCGI_KEEP_CONN is set.
+
+As a final safeguard, reject a new FastCGI request if the
+previous STDIN record was only partially consumed.
+
+Backported to 7.1: the tests use closures instead of arrow functions
+and strpos() instead of str_contains().
+
+Origin: backport, https://github.com/php/php-src/commit/28014fd092c7acdafb9c074e735f099893a5ef66
+Bug: https://github.com/php/php-src/security/advisories/GHSA-qc49-hpvq-g2w6
+---
+ main/SAPI.c                                    |   3 +-
+ main/fastcgi.c                                 |   6 ++
+ sapi/fpm/tests/unread-body-keep-conn.phpt      | 125 ++++++++++++++++++++++
+ sapi/fpm/tests/unread-body-partial-record.phpt | 127 +++++++++++++++++++++++
+ 4 files changed, 260 insertions(+), 1 deletion(-)
+
+diff --git a/main/SAPI.c b/main/SAPI.c
+index 9f5a3cb3..294f386d 100644
+--- a/main/SAPI.c
++++ b/main/SAPI.c
+@@ -504,7 +504,8 @@ SAPI_API void sapi_deactivate(void)
+ 	zend_llist_destroy(&SG(sapi_headers).headers);
+ 	if (SG(request_info).request_body) {
+ 		SG(request_info).request_body = NULL;
+-	} else if (SG(server_context)) {
++	}
++	if (SG(server_context)) {
+ 		if (!SG(post_read)) {
+ 			/* make sure we've consumed all request input data */
+ 			char dummy[SAPI_POST_BLOCK_SIZE];
+diff --git a/main/fastcgi.c b/main/fastcgi.c
+index 1277ac9a..b5584298 100644
+--- a/main/fastcgi.c
++++ b/main/fastcgi.c
+@@ -1051,6 +1051,10 @@ static int fcgi_read_request(fcgi_request *req)
+ 	int len, padding;
+ 	unsigned char buf[FCGI_MAX_LENGTH+8];
+ 
++	if (UNEXPECTED(req->in_len != 0)) {
++		return 0;
++	}
++
+ 	req->keep = 0;
+ 	req->ended = 0;
+ 	req->in_len = 0;
+@@ -1314,6 +1318,8 @@ void fcgi_close(fcgi_request *req, int force, int destroy)
+ 		req->nodelay = 0;
+ #endif
+ 		req->fd = -1;
++		/* a partially read STDIN record does not outlive its connection */
++		req->in_len = 0;
+ 
+ 		req->hook.on_close();
+ 	}
+diff --git a/sapi/fpm/tests/unread-body-keep-conn.phpt b/sapi/fpm/tests/unread-body-keep-conn.phpt
+new file mode 100644
+index 00000000..c536fea4
+--- /dev/null
++++ b/sapi/fpm/tests/unread-body-keep-conn.phpt
+@@ -0,0 +1,125 @@
++--TEST--
++FPM: unread request body cannot become a new request on a kept connection
++--SKIPIF--
++<?php include "skipif.inc"; ?>
++--FILE--
++<?php
++
++require_once "tester.inc";
++
++function record(int $type, string $content, int $id): string
++{
++    return pack('CCnnCC', 1, $type, $id, strlen($content), 0, 0) . $content;
++}
++
++function params(array $params): string
++{
++    $encoded = '';
++    $encodeLength = function (int $length): string {
++        return $length < 128 ? chr($length) : pack('N', $length | 0x80000000);
++    };
++    foreach ($params as $name => $value) {
++        $encoded .= $encodeLength(strlen($name)) . $encodeLength(strlen($value)) . $name . $value;
++    }
++    return $encoded;
++}
++
++function request(int $id, bool $keep, array $params, string $stdin): string
++{
++    return record(1, pack('nCxxxxx', 1, $keep), $id)
++        . record(4, params($params), $id)
++        . record(4, '', $id)
++        . record(5, $stdin, $id)
++        . record(5, '', $id);
++}
++
++function transact(string $address, string $request): string
++{
++    [$host, $port] = explode(':', $address);
++    $socket = fsockopen($host, (int) $port);
++    stream_set_timeout($socket, 3);
++    $written = 0;
++    while ($written < strlen($request)) {
++        $written += fwrite($socket, substr($request, $written));
++    }
++    stream_socket_shutdown($socket, STREAM_SHUT_WR);
++    $response = stream_get_contents($socket);
++    fclose($socket);
++    return $response;
++}
++
++$config = <<<CFG
++[global]
++error_log = {{FILE:LOG}}
++[unconfined]
++listen = {{ADDR}}
++pm = static
++pm.max_children = 1
++catch_workers_output = yes
++CFG;
++
++$code = <<<'PHP'
++<?php
++if ($_SERVER['REMOTE_ADDR'] === '203.0.113.1') {
++    echo "smuggled\n";
++} else {
++    $input = fopen('php://input', 'r');
++    echo "outer\n";
++}
++PHP;
++
++$tester = new FPM\Tester($config, $code);
++$script = $tester->makeSourceFile();
++$tester->start();
++$tester->expectLogStartNotices();
++
++$hiddenParams = [
++    'GATEWAY_INTERFACE' => 'FastCGI/1.0',
++    'REQUEST_METHOD' => 'GET',
++    'SCRIPT_FILENAME' => $script,
++    'SCRIPT_NAME' => '/smuggled.php',
++    'REQUEST_URI' => '/smuggled.php',
++    'SERVER_PROTOCOL' => 'HTTP/1.1',
++    'REMOTE_ADDR' => '203.0.113.1',
++    'CONTENT_LENGTH' => '0',
++];
++$hidden = request(2, false, $hiddenParams, '');
++$body = str_pad("--B\r\nContent-Disposition: form-data\r\n\r\n", 12000, 'A');
++$body = substr_replace($body, $hidden, 5120, strlen($hidden));
++
++$outerParams = [
++    'GATEWAY_INTERFACE' => 'FastCGI/1.0',
++    'REQUEST_METHOD' => 'POST',
++    'SCRIPT_FILENAME' => $script,
++    'SCRIPT_NAME' => '/open.php',
++    'REQUEST_URI' => '/open.php',
++    'SERVER_PROTOCOL' => 'HTTP/1.1',
++    'REMOTE_ADDR' => '127.0.0.1',
++    'CONTENT_TYPE' => 'multipart/form-data; boundary=B',
++    'CONTENT_LENGTH' => (string) strlen($body),
++];
++foreach ([false, true] as $keep) {
++    $response = transact($tester->getAddr(), request(1, $keep, $outerParams, $body));
++    echo 'keep ', $keep ? 'on' : 'off', ': ',
++        strpos($response, 'smuggled') !== false ? 'smuggled' : 'safe', "\n";
++}
++
++$body = 'A' . $hidden;
++$outerParams['CONTENT_TYPE'] = 'application/octet-stream';
++$outerParams['CONTENT_LENGTH'] = '1';
++$response = transact($tester->getAddr(), request(1, true, $outerParams, $body));
++echo 'partial frame: ',
++    strpos($response, 'smuggled') !== false ? 'smuggled' : 'safe', "\n";
++
++$tester->terminate();
++$tester->close();
++?>
++--EXPECT--
++keep off: safe
++keep on: safe
++partial frame: safe
++--CLEAN--
++<?php
++require_once "tester.inc";
++FPM\Tester::clean();
++?>
+diff --git a/sapi/fpm/tests/unread-body-partial-record.phpt b/sapi/fpm/tests/unread-body-partial-record.phpt
+new file mode 100644
+index 00000000..cb34d4ab
+--- /dev/null
++++ b/sapi/fpm/tests/unread-body-partial-record.phpt
+@@ -0,0 +1,127 @@
++--TEST--
++FPM: partially read STDIN record does not make the worker reject later connections
++--SKIPIF--
++<?php include "skipif.inc"; ?>
++--FILE--
++<?php
++
++require_once "tester.inc";
++
++function record(int $type, string $content, int $id): string
++{
++    return pack('CCnnCC', 1, $type, $id, strlen($content), 0, 0) . $content;
++}
++
++function params(array $params): string
++{
++    $encoded = '';
++    $encodeLength = function (int $length): string {
++        return $length < 128 ? chr($length) : pack('N', $length | 0x80000000);
++    };
++    foreach ($params as $name => $value) {
++        $encoded .= $encodeLength(strlen($name)) . $encodeLength(strlen($value)) . $name . $value;
++    }
++    return $encoded;
++}
++
++function request(int $id, bool $keep, array $params, string $stdin): string
++{
++    return record(1, pack('nCxxxxx', 1, $keep), $id)
++        . record(4, params($params), $id)
++        . record(4, '', $id)
++        . record(5, $stdin, $id)
++        . record(5, '', $id);
++}
++
++function transact(string $address, string $request): string
++{
++    [$host, $port] = explode(':', $address);
++    $socket = fsockopen($host, (int) $port);
++    stream_set_timeout($socket, 3);
++    $written = 0;
++    while ($written < strlen($request)) {
++        $written += fwrite($socket, substr($request, $written));
++    }
++    stream_socket_shutdown($socket, STREAM_SHUT_WR);
++    $response = stream_get_contents($socket);
++    fclose($socket);
++    return $response;
++}
++
++$config = <<<CFG
++[global]
++error_log = {{FILE:LOG}}
++[unconfined]
++listen = {{ADDR}}
++pm = static
++pm.max_children = 1
++catch_workers_output = yes
++CFG;
++
++$code = <<<'PHP'
++<?php
++if ($_SERVER['REMOTE_ADDR'] === '203.0.113.1') {
++    echo "smuggled\n";
++} else {
++    echo "outer ", strlen(file_get_contents('php://input')), "\n";
++}
++PHP;
++
++$tester = new FPM\Tester($config, $code);
++$script = $tester->makeSourceFile();
++$tester->start();
++$tester->expectLogStartNotices();
++
++$hiddenParams = [
++    'GATEWAY_INTERFACE' => 'FastCGI/1.0',
++    'REQUEST_METHOD' => 'GET',
++    'SCRIPT_FILENAME' => $script,
++    'SCRIPT_NAME' => '/smuggled.php',
++    'REQUEST_URI' => '/smuggled.php',
++    'SERVER_PROTOCOL' => 'HTTP/1.1',
++    'REMOTE_ADDR' => '203.0.113.1',
++    'CONTENT_LENGTH' => '0',
++];
++$hidden = request(2, false, $hiddenParams, '');
++$outerParams = [
++    'GATEWAY_INTERFACE' => 'FastCGI/1.0',
++    'REQUEST_METHOD' => 'POST',
++    'SCRIPT_FILENAME' => $script,
++    'SCRIPT_NAME' => '/open.php',
++    'REQUEST_URI' => '/open.php',
++    'SERVER_PROTOCOL' => 'HTTP/1.1',
++    'REMOTE_ADDR' => '127.0.0.1',
++    'CONTENT_TYPE' => 'application/octet-stream',
++    'CONTENT_LENGTH' => '1',
++];
++$plainParams = ['REQUEST_METHOD' => 'GET', 'CONTENT_LENGTH' => '0'] + $outerParams;
++unset($plainParams['CONTENT_TYPE']);
++
++/* The STDIN record is longer than CONTENT_LENGTH so it is left partially read. */
++foreach ([false, true] as $keep) {
++    $response = transact($tester->getAddr(), request(1, $keep, $outerParams, 'A' . $hidden));
++    echo 'keep ', $keep ? 'on' : 'off', ': ',
++        strpos($response, 'smuggled') !== false ? 'smuggled' : 'safe', ', ',
++        strpos($response, 'outer 1') !== false ? 'served' : 'not served', "\n";
++    /* The only worker must still serve new connections. */
++    foreach ([1, 2] as $n) {
++        $response = transact($tester->getAddr(), request(1, false, $plainParams, ''));
++        echo "  next connection $n: ", strpos($response, 'outer 0') !== false ? 'served' : 'not served', "\n";
++    }
++}
++
++$tester->terminate();
++$tester->close();
++?>
++--EXPECT--
++keep off: safe, served
++  next connection 1: served
++  next connection 2: served
++keep on: safe, served
++  next connection 1: served
++  next connection 2: served
++--CLEAN--
++<?php
++require_once "tester.inc";
++FPM\Tester::clean();
++?>
diff --git a/php-cve-2026-129291.patch b/php-cve-2026-129291.patch
new file mode 100644
index 0000000..a785a2f
--- /dev/null
+++ b/php-cve-2026-129291.patch
@@ -0,0 +1,50 @@
+From: "Ian P. Christian" <ian.christian at zoopla.co.uk>
+Date: Tue, 27 Oct 2026 17:59:48 +0100
+Subject: [PATCH] Fix GHSA-jm4m-qfqx-967m: FPM worker stdio pipe fd closed twice
+
+When a worker exits while a process it started still holds its stdout or
+stderr pipe, draining the pipe gets EAGAIN instead of EOF and the master
+closed the read end without removing its epoll event. A sibling worker
+stopped between fork and closing its inherited descriptors keeps that
+registration alive, and a later write to the pipe dispatches an event
+pointing into the freed child record. Remove the event before closing the
+descriptor.
+
+Backported to 7.1: 7.1 frees the child at once (no postponed free from
+GH-10461), so only the event removal applies; the upstream test checks
+the double close of that postponed free and is not included.
+
+Origin: backport, https://github.com/php/php-src/commit/8c38b791449708540fd356ddc6927f463faeca91
+Bug: https://github.com/php/php-src/security/advisories/GHSA-jm4m-qfqx-967m
+---
+ sapi/fpm/fpm/fpm_children.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c
+index 9e7ead9c..0dfd97f1 100644
+--- a/sapi/fpm/fpm/fpm_children.c
++++ b/sapi/fpm/fpm/fpm_children.c
+@@ -68,7 +68,11 @@ static void fpm_child_close(struct fpm_child_s *child, int in_event_loop) /* {{{
+ 			fpm_event_fire(&child->ev_stdout);
+ 		}
+ 		if (child->fd_stdout != -1) {
++			if (in_event_loop) {
++				fpm_event_del(&child->ev_stdout);
++			}
+ 			close(child->fd_stdout);
++			child->fd_stdout = -1;
+ 		}
+ 	}
+ 
+@@ -77,7 +81,11 @@ static void fpm_child_close(struct fpm_child_s *child, int in_event_loop) /* {{{
+ 			fpm_event_fire(&child->ev_stderr);
+ 		}
+ 		if (child->fd_stderr != -1) {
++			if (in_event_loop) {
++				fpm_event_del(&child->ev_stderr);
++			}
+ 			close(child->fd_stderr);
++			child->fd_stderr = -1;
+ 		}
+ 	}
+ 
diff --git a/php-cve-2026-129292.patch b/php-cve-2026-129292.patch
new file mode 100644
index 0000000..3e2d080
--- /dev/null
+++ b/php-cve-2026-129292.patch
@@ -0,0 +1,311 @@
+From: Jakub Zelenka <bukka at php.net>
+Date: Mon, 26 Oct 2026 20:10:08 +0100
+Subject: [PATCH] Fix GHSA-3mg3-cr28-46gc: FPM XSS within status endpoint via user and script
+
+The fix for GHSA-7qg2-v9fj-4mwv escaped only the request URI and query
+string. The request method, auth user and script filename were still
+printed raw in the full status output. Escape all of them using a common
+helper.
+
+Backported to 7.1: ext/json can be a shared module (it is in PLD), which
+the FPM binary cannot call, so JSON output is escaped by a local copy of
+php_json_escape_string()'s default rules; php-cve-2026-6735.patch left
+JSON unescaped for the same reason, this covers the request URI and query
+string there too.
+
+Origin: backport, https://github.com/php/php-src/commit/1ecb92f2cdeb235bb10d6c220c9be4a13f527243
+Bug: https://github.com/php/php-src/security/advisories/GHSA-3mg3-cr28-46gc
+---
+ sapi/fpm/fpm/fpm_status.c                         | 137 +++++++++++++++-----
+ .../fpm/tests/ghsa-3mg3-cr28-46gc-status-xss.phpt |  70 ++++++++++
+ 2 files changed, 174 insertions(+), 33 deletions(-)
+
+diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c
+index 2c0d7703..41428050 100644
+--- a/sapi/fpm/fpm/fpm_status.c
++++ b/sapi/fpm/fpm/fpm_status.c
+@@ -15,6 +15,7 @@
+ #include "fpm_conf.h"
+ #include "fpm_php.h"
+ #include <ext/standard/html.h>
++#include "zend_smart_str.h"
+ 
+ static char *fpm_status_uri = NULL;
+ static char *fpm_status_ping_uri = NULL;
+@@ -45,13 +46,92 @@ int fpm_status_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
+ }
+ /* }}} */
+ 
++/* ext/json may be a shared module, which the FPM binary cannot call, so the
++ * string is escaped here as php_json_escape_string() does by default */
++static zend_string *fpm_status_json_escape(const char *str)
++{
++	static const char digits[] = "0123456789abcdef";
++	const unsigned char *s = (const unsigned char *) str;
++	size_t len = strlen(str), pos = 0;
++	smart_str buf = {0};
++
++	while (pos < len) {
++		int status;
++		unsigned int us = php_next_utf8_char(s, len, &pos, &status);
++
++		if (status != SUCCESS) {
++			/* invalid UTF-8 is dropped, as with PHP_JSON_INVALID_UTF8_IGNORE */
++			continue;
++		}
++		if (us >= 0x80) {
++			if (us >= 0x10000) {
++				us -= 0x10000;
++				smart_str_appendl(&buf, "\\u", 2);
++				smart_str_appendc(&buf, digits[0xd]);
++				smart_str_appendc(&buf, digits[0x8 | ((us >> 18) & 0x3)]);
++				smart_str_appendc(&buf, digits[(us >> 14) & 0xf]);
++				smart_str_appendc(&buf, digits[(us >> 10) & 0xf]);
++				us = 0xdc00 | (us & 0x3ff);
++			}
++			smart_str_appendl(&buf, "\\u", 2);
++			smart_str_appendc(&buf, digits[(us >> 12) & 0xf]);
++			smart_str_appendc(&buf, digits[(us >> 8) & 0xf]);
++			smart_str_appendc(&buf, digits[(us >> 4) & 0xf]);
++			smart_str_appendc(&buf, digits[us & 0xf]);
++			continue;
++		}
++		switch (us) {
++			case '"':  smart_str_appendl(&buf, "\\\"", 2); break;
++			case '\\': smart_str_appendl(&buf, "\\\\", 2); break;
++			case '/':  smart_str_appendl(&buf, "\\/", 2); break;
++			case '\b': smart_str_appendl(&buf, "\\b", 2); break;
++			case '\f': smart_str_appendl(&buf, "\\f", 2); break;
++			case '\n': smart_str_appendl(&buf, "\\n", 2); break;
++			case '\r': smart_str_appendl(&buf, "\\r", 2); break;
++			case '\t': smart_str_appendl(&buf, "\\t", 2); break;
++			default:
++				if (us < ' ') {
++					smart_str_appendl(&buf, "\\u00", 4);
++					smart_str_appendc(&buf, digits[(us >> 4) & 0xf]);
++					smart_str_appendc(&buf, digits[us & 0xf]);
++				} else {
++					smart_str_appendc(&buf, (char) us);
++				}
++		}
++	}
++	if (!buf.s) {
++		/* the caller frees the result, so not the interned empty string */
++		return zend_string_init("", 0, 0);
++	}
++	smart_str_0(&buf);
++	return buf.s;
++}
++
++static char *fpm_status_escape(const char *str, zend_bool encode_html, zend_bool encode_json, zend_string **tmp)
++{
++	*tmp = NULL;
++	if (str[0] == '\0') {
++		return NULL;
++	}
++	if (encode_html) {
++		*tmp = php_escape_html_entities_ex((unsigned char *) str, strlen(str), 1,
++				ENT_DISALLOWED | ENT_HTML_DOC_XML1 | ENT_COMPAT, NULL, /* double_encode */ 1);
++		return ZSTR_VAL(*tmp);
++	}
++	if (encode_json) {
++		*tmp = fpm_status_json_escape(str);
++		return ZSTR_VAL(*tmp);
++	}
++	return (char *) str;
++}
++
+ int fpm_status_handle_request(void) /* {{{ */
+ {
+ 	struct fpm_scoreboard_s scoreboard, *scoreboard_p;
+ 	struct fpm_scoreboard_proc_s proc;
+ 	char *buffer, *time_format, time_buffer[64];
+ 	time_t now_epoch;
+-	int full, encode;
++	int full, encode, encode_json;
+ 	char *short_syntax, *short_post;
+ 	char *full_pre, *full_syntax, *full_post, *full_separator;
+ 	zend_string *_GET_str;
+@@ -131,6 +211,7 @@ int fpm_status_handle_request(void) /* {{{ */
+ 		short_syntax = short_post = NULL;
+ 		full_separator = full_pre = full_syntax = full_post = NULL;
+ 		encode = 0;
++		encode_json = 0;
+ 
+ 		/* HTML */
+ 		if (fpm_php_get_string_from_table(_GET_str, "html")) {
+@@ -263,6 +344,7 @@ int fpm_status_handle_request(void) /* {{{ */
+ 		} else if (fpm_php_get_string_from_table(_GET_str, "json")) {
+ 			sapi_add_header_ex(ZEND_STRL("Content-Type: application/json"), 1, 1);
+ 			time_format = "%s";
++			encode_json = 1;
+ 
+ 			short_syntax =
+ 				"{"
+@@ -387,8 +469,10 @@ int fpm_status_handle_request(void) /* {{{ */
+ 		if (full_syntax) {
+ 			unsigned int i;
+ 			int first;
+-			zend_string *tmp_query_string, *tmp_request_uri_string;
+-			char *query_string, *request_uri_string;
++			zend_string *tmp_request_method_string, *tmp_request_uri_string, *tmp_query_string;
++			zend_string *tmp_auth_user_string, *tmp_script_filename_string;
++			char *request_method_string, *request_uri_string, *query_string;
++			char *auth_user_string, *script_filename_string;
+ 			struct timeval duration, now;
+ #ifdef HAVE_FPM_LQ
+ 			float cpu;
+@@ -415,33 +499,11 @@ int fpm_status_handle_request(void) /* {{{ */
+ 					}
+ 				}
+ 
+-				request_uri_string = NULL;
+-				tmp_request_uri_string = NULL;
+-				if (proc.request_uri[0] != '\0') {
+-					if (encode) {
+-						tmp_request_uri_string = php_escape_html_entities_ex(
+-								(unsigned char*)proc.request_uri,
+-								strlen(proc.request_uri), 1, ENT_DISALLOWED | ENT_HTML_DOC_XML1 | ENT_COMPAT,
+-								NULL, /* double_encode */ 1);
+-						request_uri_string = ZSTR_VAL(tmp_request_uri_string);
+-					} else {
+-						request_uri_string = proc.request_uri;
+-					}
+-				}
+-
+-				query_string = NULL;
+-				tmp_query_string = NULL;
+-				if (proc.query_string[0] != '\0') {
+-					if (!encode) {
+-						query_string = proc.query_string;
+-					} else {
+-						tmp_query_string = php_escape_html_entities_ex(
+-								(unsigned char*)proc.query_string,
+-								strlen(proc.query_string), 1, ENT_DISALLOWED | ENT_HTML_DOC_XML1 | ENT_COMPAT,
+-								NULL, /* double_encode */ 1);
+-						query_string = ZSTR_VAL(tmp_query_string);
+-					}
+-				}
++				request_method_string = fpm_status_escape(proc.request_method, encode, encode_json, &tmp_request_method_string);
++				request_uri_string = fpm_status_escape(proc.request_uri, encode, encode_json, &tmp_request_uri_string);
++				query_string = fpm_status_escape(proc.query_string, encode, encode_json, &tmp_query_string);
++				auth_user_string = fpm_status_escape(proc.auth_user, encode, encode_json, &tmp_auth_user_string);
++				script_filename_string = fpm_status_escape(proc.script_filename, encode, encode_json, &tmp_script_filename_string);
+ 
+ #ifdef HAVE_FPM_LQ
+ 				/* prevent NaN */
+@@ -465,13 +527,13 @@ int fpm_status_handle_request(void) /* {{{ */
+ 					now_epoch - proc.start_epoch,
+ 					proc.requests,
+ 					duration.tv_sec * 1000000UL + duration.tv_usec,
+-					proc.request_method[0] != '\0' ? proc.request_method : "-",
++					request_method_string ? request_method_string : "-",
+ 					request_uri_string ? request_uri_string : "-",
+ 					query_string ? "?" : "",
+ 					query_string ? query_string : "",
+ 					proc.content_length,
+-					proc.auth_user[0] != '\0' ? proc.auth_user : "-",
+-					proc.script_filename[0] != '\0' ? proc.script_filename : "-",
++					auth_user_string ? auth_user_string : "-",
++					script_filename_string ? script_filename_string : "-",
+ #ifdef HAVE_FPM_LQ
+ 					proc.request_stage == FPM_REQUEST_ACCEPTING ? cpu : 0.,
+ #endif
+@@ -479,12 +541,21 @@ int fpm_status_handle_request(void) /* {{{ */
+ 				PUTS(buffer);
+ 				efree(buffer);
+ 
++				if (tmp_request_method_string) {
++					zend_string_free(tmp_request_method_string);
++				}
+ 				if (tmp_request_uri_string) {
+ 					zend_string_free(tmp_request_uri_string);
+ 				}
+ 				if (tmp_query_string) {
+ 					zend_string_free(tmp_query_string);
+ 				}
++				if (tmp_auth_user_string) {
++					zend_string_free(tmp_auth_user_string);
++				}
++				if (tmp_script_filename_string) {
++					zend_string_free(tmp_script_filename_string);
++				}
+ 			}
+ 
+ 			if (full_post) {
+diff --git a/sapi/fpm/tests/ghsa-3mg3-cr28-46gc-status-xss.phpt b/sapi/fpm/tests/ghsa-3mg3-cr28-46gc-status-xss.phpt
+new file mode 100644
+index 00000000..0a40a5ad
+--- /dev/null
++++ b/sapi/fpm/tests/ghsa-3mg3-cr28-46gc-status-xss.phpt
+@@ -0,0 +1,70 @@
++--TEST--
++FPM: GHSA-3mg3-cr28-46gc - status xss via request method, auth user and script filename
++--SKIPIF--
++<?php include "skipif.inc"; ?>
++--FILE--
++<?php
++
++require_once "tester.inc";
++
++$cfg = <<<EOT
++[global]
++error_log = {{FILE:LOG}}
++[unconfined]
++listen = {{ADDR}}
++pm = static
++pm.max_children = 3
++pm.status_path = /status
++catch_workers_output = yes
++EOT;
++
++$code = <<<EOT
++<?php
++usleep(300000);
++EOT;
++
++$scriptFilename = __DIR__ . '/ghsa-3mg3-cr28-46gc-<svg>.php';
++file_put_contents($scriptFilename, $code);
++
++$tester = new FPM\Tester($cfg, $code);
++$tester->start();
++$tester->expectLogStartNotices();
++$responses = $tester
++        ->multiRequest([
++                [
++                    'uri' => '/ghsa-3mg3-cr28-46gc-<svg>.php',
++                    'headers' => [
++                        'REQUEST_METHOD' => '<svg>',
++                        'HTTP_AUTHORIZATION' => 'Basic ' . base64_encode('"<svg onload=x>:x'),
++                        'SCRIPT_FILENAME' => $scriptFilename,
++                    ],
++                ],
++                ['uri' => '/status', 'query' => 'full&html', 'delay' => 100000],
++                ['uri' => '/status', 'query' => 'full&json', 'delay' => 100000],
++        ]);
++var_dump(strpos($responses[1]->getBody(), '<svg'));
++var_dump(substr_count($responses[1]->getBody(), '<svg'));
++$status = json_decode($responses[2]->getBody('application/json'), true);
++foreach ($status['processes'] as $proc) {
++    if ($proc['request method'] === '<svg>') {
++        var_dump($proc['user'], $proc['script'] === $scriptFilename);
++    }
++}
++$tester->terminate();
++$tester->expectLogTerminatingNotices();
++$tester->close();
++
++?>
++Done
++--EXPECT--
++bool(false)
++int(4)
++string(15) ""<svg onload=x>"
++bool(true)
++Done
++--CLEAN--
++<?php
++require_once "tester.inc";
++FPM\Tester::clean();
++ at unlink(__DIR__ . '/ghsa-3mg3-cr28-46gc-<svg>.php');
++?>
diff --git a/php-cve-2026-129474.patch b/php-cve-2026-129474.patch
new file mode 100644
index 0000000..0eed8d7
--- /dev/null
+++ b/php-cve-2026-129474.patch
@@ -0,0 +1,175 @@
+From: Arnaud Le Blanc <arnaud.lb at gmail.com>
+Date: Sat, 14 Nov 2026 20:55:25 +0100
+Subject: [PATCH] Fix GHSA-8mjj-2r7p-4hg2: UAF in debug_backtrace_get_args() on
+ trampoline calls
+
+Extra arguments are moved after CVs and TMPs by i_init_func_execute_data(),
+except for trampoline calls, but debug_backtrace_get_args() assumes the usual
+argument layout, leading to UAF.
+
+Backported to 7.1: there are no fatal_error_backtraces, so the Zend test is
+dropped; the frame is still reachable from debug_backtrace() in an async
+pcntl signal handler and from phpdbg. The 7.1 phpdbg lexer does not take
+opcode names with underscores, so the phpdbg tests step into the
+trampoline frame instead of breaking on ZEND_CALL_TRAMPOLINE.
+
+Origin: backport, https://github.com/php/php-src/commit/03c403286d9440c2b3a840812652be4e221d1be7
+Bug: https://github.com/php/php-src/security/advisories/GHSA-8mjj-2r7p-4hg2
+---
+ Zend/zend_builtin_functions.c                  |  6 +++-
+ sapi/phpdbg/phpdbg.c                           |  1 +
+ sapi/phpdbg/phpdbg_frame.c                     |  8 +++++
+ sapi/phpdbg/tests/GHSA-8mjj-2r7p-4hg2-001.phpt | 43 ++++++++++++++++++++++++
+ sapi/phpdbg/tests/GHSA-8mjj-2r7p-4hg2-002.phpt | 40 ++++++++++++++++++++++
+ 5 files changed, 97 insertions(+), 1 deletion(-)
+
+diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
+index b7496ab2..d83bd683 100644
+--- a/Zend/zend_builtin_functions.c
++++ b/Zend/zend_builtin_functions.c
+@@ -2307,7 +2307,11 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array) /
+ 
+ 		zend_hash_real_init(Z_ARRVAL_P(arg_array), 1);
+ 		ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(arg_array)) {
+-			if (call->func->type == ZEND_USER_FUNCTION) {
++			/* Extra args are moved after CVs and TMPs in user functions, except
++			 * for trampoline frames (see i_init_func_execute_data()).
++			 */
++			if (call->func->type == ZEND_USER_FUNCTION
++			 && !(call->func->op_array.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
+ 				uint32_t first_extra_arg = MIN(num_args, call->func->op_array.num_args);
+ 
+ 				if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_HAS_SYMBOL_TABLE)) {
+diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
+index 89b049dc..81514a83 100644
+--- a/sapi/phpdbg/phpdbg.c
++++ b/sapi/phpdbg/phpdbg.c
+@@ -157,6 +157,7 @@ static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */
+ 	pg->oplog = NULL;
+ 	memset(pg->io, 0, sizeof(pg->io));
+ 	pg->frame.num = 0;
++	pg->frame.generator = 0;
+ 	pg->sapi_name_ptr = NULL;
+ 	pg->socket_fd = -1;
+ 	pg->socket_server_fd = -1;
+diff --git a/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c
+index 7cdedcb4..f8ddd0bc 100644
+--- a/sapi/phpdbg/phpdbg_frame.c
++++ b/sapi/phpdbg/phpdbg_frame.c
+@@ -58,6 +58,12 @@ zend_string *phpdbg_compile_stackframe(zend_execute_data *ex) {
+ 	uint32_t i = 0, first_extra_arg = op_array->num_args, num_args = ZEND_CALL_NUM_ARGS(ex);
+ 	zval *p = ZEND_CALL_ARG(ex, 1);
+ 
++	if (ex->func->op_array.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
++		/* A __call/__callStatic trampoline doesn't move extra args
++		 * behind the CVs and TMPs (see i_init_func_execute_data()). */
++		first_extra_arg = num_args;
++	}
++
+ 	if (op_array->scope) {
+ 		smart_str_append(&s, op_array->scope->name);
+ 		smart_str_appends(&s, "::");
+@@ -88,6 +94,8 @@ zend_string *phpdbg_compile_stackframe(zend_execute_data *ex) {
+ 		smart_str_appends(&s, " [internal function]");
+ 	}
+ 
++	smart_str_0(&s);
++
+ 	return s.s;
+ }
+ 
+diff --git a/sapi/phpdbg/tests/GHSA-8mjj-2r7p-4hg2-001.phpt b/sapi/phpdbg/tests/GHSA-8mjj-2r7p-4hg2-001.phpt
+new file mode 100644
+index 00000000..ed7751e4
+--- /dev/null
++++ b/sapi/phpdbg/tests/GHSA-8mjj-2r7p-4hg2-001.phpt
+@@ -0,0 +1,43 @@
++--TEST--
++GHSA-8mjj-2r7p-4hg2: phpdbg frame display for __call trampoline
++--INI--
++opcache.enable=0
++--PHPDBG--
++b caller
++r
++s
++f 1
++f 0
++q
++--EXPECTF--
++[Successful compilation of %s]
++prompt> [Breakpoint #0 added at caller]
++prompt> [Breakpoint #0 in caller() at %s:5, hits: 1]
++>00005:     C::test(1, 2, 3, 4);
++ 00006: }
++ 00007:%w
++prompt> [L5 %s SEND_VAL_EX %s]
++[L5 %s SEND_VAL_EX %s]
++[L5 %s SEND_VAL_EX %s]
++[L5 %s SEND_VAL_EX %s]
++[L5 %s DO_FCALL %s]
++[L0 %s CALL_TRAMPOLINE %s]
++ 00001: <?php
++ 00002: class C { static function __callStatic($name, $args) {} }
++prompt> [Switched to frame #1: caller() at %s:5]
++>00005:     C::test(1, 2, 3, 4);
++ 00006: }
++ 00007:%w
++prompt> [Switched to frame #0: C::test(1, 2, 3, 4) at %s:0]
++ 00001: <?php
++ 00002: class C { static function __callStatic($name, $args) {} }
++prompt>
++--FILE--
++<?php
++class C { static function __callStatic($name, $args) {} }
++
++function caller() {
++    C::test(1, 2, 3, 4);
++}
++
++caller();
+diff --git a/sapi/phpdbg/tests/GHSA-8mjj-2r7p-4hg2-002.phpt b/sapi/phpdbg/tests/GHSA-8mjj-2r7p-4hg2-002.phpt
+new file mode 100644
+index 00000000..9ad7b386
+--- /dev/null
++++ b/sapi/phpdbg/tests/GHSA-8mjj-2r7p-4hg2-002.phpt
+@@ -0,0 +1,40 @@
++--TEST--
++GHSA-8mjj-2r7p-4hg2: phpdbg backtrace for __call trampoline with attached symbol table
++--INI--
++opcache.enable=0
++--PHPDBG--
++b caller
++r
++s
++i v
++back
++q
++--EXPECTF--
++[Successful compilation of %s]
++prompt> [Breakpoint #0 added at caller]
++prompt> [Breakpoint #0 in caller() at %s:5, hits: 1]
++>00005:     C::test(1, 2, 3, 4);
++ 00006: }
++ 00007:%w
++prompt> [L5 %s SEND_VAL_EX %s]
++[L5 %s SEND_VAL_EX %s]
++[L5 %s SEND_VAL_EX %s]
++[L5 %s SEND_VAL_EX %s]
++[L5 %s DO_FCALL %s]
++[L0 %s CALL_TRAMPOLINE %s]
++ 00001: <?php
++ 00002: class C { static function __callStatic($name, $args) {} }
++prompt> [Variables in C::test() (0)]
++prompt> frame #0: C::test(1, 2, 3, 4) at %s:0
++frame #1: caller() at %s:5
++frame #2: {main} at %s:8
++prompt>
++--FILE--
++<?php
++class C { static function __callStatic($name, $args) {} }
++
++function caller() {
++    C::test(1, 2, 3, 4);
++}
++
++caller();
diff --git a/php-cve-2026-129481.patch b/php-cve-2026-129481.patch
new file mode 100644
index 0000000..0f92356
--- /dev/null
+++ b/php-cve-2026-129481.patch
@@ -0,0 +1,121 @@
+From: Arnaud Le Blanc <arnaud.lb at gmail.com>
+Date: Tue, 10 Nov 2026 17:33:58 +0100
+Subject: [PATCH] Fix GHSA-g3vh-838c-65v7: do not continue after an interrupted
+ RSHUTDOWN()
+
+A bailout in a module's request shutdown, e.g. a fatal error from a stream
+close callback while the session variables are destroyed, leaves module
+state pointing into the request memory that is freed afterwards; the next
+request handled by the process then uses it. Terminate the process instead.
+
+Backported to 7.1: only the Zend part; there is no
+PS(session_started_filename), the stale state here is PS(mod_user_names),
+which the next request's session RSHUTDOWN destroys. 7.1 runs all module
+RSHUTDOWNs in one zend_try. The FPM test is replaced by a php-cgi -T 2 one.
+
+Origin: backport, https://github.com/php/php-src/commit/ad9b44ae611962c8b770ffc962ddff0c30d7d77c
+Bug: https://github.com/php/php-src/security/advisories/GHSA-g3vh-838c-65v7
+---
+ Zend/zend_API.c                         |  7 ++++
+ sapi/cgi/tests/ghsa-g3vh-838c-65v7.phpt | 68 +++++++++++++++++++++++++++++++
+ 2 files changed, 75 insertions(+)
+
+diff --git a/Zend/zend_API.c b/Zend/zend_API.c
+index 33dc54e1..cb0da683 100644
+--- a/Zend/zend_API.c
++++ b/Zend/zend_API.c
+@@ -32,6 +32,10 @@
+ #include "zend_closures.h"
+ #include "zend_inheritance.h"
+ 
++#ifdef HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
+ #ifdef HAVE_STDARG_H
+ #include <stdarg.h>
+ #endif
+@@ -2586,6 +2590,9 @@ ZEND_API void zend_deactivate_modules(void) /* {{{ */
+ 				p++;
+ 			}
+ 		}
++	} zend_catch {
++		/* module shutdown is incomplete */
++		_exit(1);
+ 	} zend_end_try();
+ }
+ /* }}} */
+diff --git a/sapi/cgi/tests/ghsa-g3vh-838c-65v7.phpt b/sapi/cgi/tests/ghsa-g3vh-838c-65v7.phpt
+new file mode 100644
+index 00000000..8b5e0d2d
+--- /dev/null
++++ b/sapi/cgi/tests/ghsa-g3vh-838c-65v7.phpt
+@@ -0,0 +1,68 @@
++--TEST--
++GHSA-g3vh-838c-65v7: php-cgi exits after an interrupted session shutdown
++--SKIPIF--
++<?php
++include "skipif.inc";
++if (!extension_loaded('session')) die('skip session extension required');
++?>
++--FILE--
++<?php
++include "include.inc";
++
++$php = get_cgi_path();
++$dir = __DIR__ . '/ghsa-g3vh-838c-65v7.dir';
++ at mkdir($dir);
++foreach (glob("$dir/*") as $file) {
++    unlink($file);
++}
++$script = "$dir/script.php";
++file_put_contents($script, <<<'PHP'
++<?php
++$marker = __DIR__ . '/producer-done';
++if (file_exists($marker)) {
++    echo "next request\n";
++    return;
++}
++touch($marker);
++class ShutdownStream {
++    public $context;
++    public function stream_open($path, $mode, $options, &$openedPath) { return true; }
++    public function stream_write($data) { return strlen($data); }
++    public function stream_close() { trigger_error('session shutdown bailout', E_USER_ERROR); }
++}
++stream_wrapper_register('shutdown-test', 'ShutdownStream');
++session_set_save_handler(new SessionHandler, false);
++session_id('ghsag3vh');
++session_start();
++$_SESSION['stream'] = fopen('shutdown-test://session', 'w');
++unset($_SESSION);
++echo "producer\n";
++PHP
++);
++
++/* The bailout from the session RSHUTDOWN of the first request left module
++ * state pointing into its freed request memory, so the second must not run. */
++$cmd = escapeshellarg($php) . ' -q -T 2 -d opcache.enable=0 -d display_errors=0 -d log_errors=0'
++    . ' -d session.save_path=' . escapeshellarg($dir) . ' ' . escapeshellarg($script);
++/* run-tests sets empty CGI variables, which would make php-cgi look for a request */
++$env = getenv();
++foreach (array('REDIRECT_STATUS', 'QUERY_STRING', 'PATH_TRANSLATED', 'SCRIPT_FILENAME',
++        'REQUEST_METHOD', 'CONTENT_TYPE', 'CONTENT_LENGTH') as $name) {
++    unset($env[$name]);
++}
++$proc = proc_open($cmd, array(0 => array('file', '/dev/null', 'r'), 1 => array('pipe', 'w'), 2 => array('file', '/dev/null', 'w')), $pipes, null, $env);
++echo stream_get_contents($pipes[1]);
++fclose($pipes[1]);
++var_dump(proc_close($proc));
++?>
++--CLEAN--
++<?php
++$dir = __DIR__ . '/ghsa-g3vh-838c-65v7.dir';
++foreach (glob("$dir/*") as $file) {
++    unlink($file);
++}
++ at rmdir($dir);
++?>
++--EXPECT--
++producer
++int(1)
diff --git a/php-cve-2026-129496.patch b/php-cve-2026-129496.patch
new file mode 100644
index 0000000..54f508c
--- /dev/null
+++ b/php-cve-2026-129496.patch
@@ -0,0 +1,84 @@
+From: Ilija Tovilo <ilija.tovilo at me.com>
+Date: Sun, 15 Nov 2026 15:25:20 +0100
+Subject: [PATCH] Fix GHSA-gr4f-wgx5-jpfv: DATEG(tzcache) use-after-free
+
+A diagnostic logged to the error_log file during module startup caches
+the timezone in startup memory, which is freed when startup ends; a
+diagnostic in the next request before the date extension's RINIT then
+uses the freed DATEG(tzcache). Only use the cached local timezone once
+the modules are activated and the executor runs.
+
+Backported to 7.1: 7.1 has no zend_test.warn_on_startup, the test uses
+an invalid session.sid_length as the startup warning (session is a shared
+module, so SKIPIF instead of --EXTENSIONS--, which 7.1 run-tests cannot
+do for CGI) and checks the timezone of the logged lines. Whether freed
+memory is reused there depends on the heap layout, so the test may pass
+on an unfixed build.
+
+Origin: backport, https://github.com/php/php-src/commit/f986c5ca37c0fdc50595d8291a9920a1df23bf38
+Bug: https://github.com/php/php-src/security/advisories/GHSA-gr4f-wgx5-jpfv
+---
+ ext/date/tests/GHSA-gr4f-wgx5-jpfv.phpt | 33 +++++++++++++++++++++++++++++++
+ main/main.c                             | 10 +---------
+ 2 files changed, 34 insertions(+), 9 deletions(-)
+
+diff --git a/ext/date/tests/GHSA-gr4f-wgx5-jpfv.phpt b/ext/date/tests/GHSA-gr4f-wgx5-jpfv.phpt
+new file mode 100644
+index 00000000..72a1f3bd
+--- /dev/null
++++ b/ext/date/tests/GHSA-gr4f-wgx5-jpfv.phpt
+@@ -0,0 +1,33 @@
++--TEST--
++GHSA-gr4f-wgx5-jpfv: DATEG(tzcache) use-after-free
++--GET--
++a=1&b=2
++--SKIPIF--
++<?php
++ at unlink(__DIR__ . "/GHSA-gr4f-wgx5-jpfv.log");
++if (!extension_loaded("session")) die("skip session extension required");
++?>
++--INI--
++error_log={PWD}/GHSA-gr4f-wgx5-jpfv.log
++log_errors=1
++display_errors=0
++date.timezone=UTC
++max_input_vars=1
++session.sid_length=5
++--FILE--
++<?php
++/* the startup warning about session.sid_length is logged while module startup memory
++ * is in use, the max_input_vars one before the date extension's request startup */
++foreach (file(__DIR__ . "/GHSA-gr4f-wgx5-jpfv.log") as $line) {
++	echo preg_replace('/^\[\d\d-\w\w\w-\d{4} \d\d:\d\d:\d\d /', '[', $line);
++}
++echo "Hello world\n";
++?>
++--CLEAN--
++<?php
++ at unlink(__DIR__ . "/GHSA-gr4f-wgx5-jpfv.log");
++?>
++--EXPECT--
++[UTC] PHP Warning:  PHP Startup: session.configuration 'session.sid_length' must be between 22 and 256. in Unknown on line 0
++[UTC] PHP Warning:  Unknown: Input variables exceeded 1. To increase the limit change max_input_vars in php.ini. in Unknown on line 0
++Hello world
+diff --git a/main/main.c b/main/main.c
+index 71ac9fbb..0599f124 100644
+--- a/main/main.c
++++ b/main/main.c
+@@ -702,15 +702,7 @@ PHPAPI ZEND_COLD void php_log_err_with_severity(char *log_message, int syslog_ty
+ 			zend_string *error_time_str;
+ 
+ 			time(&error_time);
+-#ifdef ZTS
+-			if (!php_during_module_startup()) {
+-				error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1);
+-			} else {
+-				error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0);
+-			}
+-#else
+-			error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1);
+-#endif
++			error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, PG(modules_activated) && EG(active));
+ 			len = spprintf(&tmp, 0, "[%s] %s%s", ZSTR_VAL(error_time_str), log_message, PHP_EOL);
+ #ifdef PHP_WIN32
+ 			php_flock(fd, 2);
diff --git a/php-cve-2026-129506.patch b/php-cve-2026-129506.patch
new file mode 100644
index 0000000..9e0fc34
--- /dev/null
+++ b/php-cve-2026-129506.patch
@@ -0,0 +1,72 @@
+From: Jakub Zelenka <bukka at php.net>
+Date: Sun, 1 Nov 2026 15:18:09 +0100
+Subject: [PATCH] Fix GHSA-4646-p932-gw34: keep SOAP DTD alive during cleanup
+
+cleanup_xml_node() freed the DTD while attribute values with entity
+references still shared its content, and removing it also bypassed the
+SOAP server's DTD rejection.
+
+Backported to 7.1: SKIPIF instead of --EXTENSIONS--.
+
+Origin: backport, https://github.com/php/php-src/commit/66db5cda7df3d7a0e1fc7b171bd9ca318fca49fb
+Bug: https://github.com/php/php-src/security/advisories/GHSA-4646-p932-gw34
+---
+ ext/soap/php_xml.c                      |  3 +++
+ ext/soap/tests/GHSA-4646-p932-gw34.phpt | 35 +++++++++++++++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
+index 0e3339fa..5a180516 100644
+--- a/ext/soap/php_xml.c
++++ b/ext/soap/php_xml.c
+@@ -53,6 +53,9 @@ static void cleanup_xml_node(xmlNodePtr node)
+ 				xmlUnlinkNode(trav);
+ 				xmlFreeNode(trav);
+ 			}
++		} else if (trav->type == XML_DTD_NODE) {
++			/* Attribute-value entity references can share content with the DTD.
++			 * Keep it alive until the document itself is freed. */
+ 		} else if ((trav->type != XML_ELEMENT_NODE) &&
+ 		           (trav->type != XML_CDATA_SECTION_NODE)) {
+ 			xmlUnlinkNode(trav);
+diff --git a/ext/soap/tests/GHSA-4646-p932-gw34.phpt b/ext/soap/tests/GHSA-4646-p932-gw34.phpt
+new file mode 100644
+index 00000000..1ffcde10
+--- /dev/null
++++ b/ext/soap/tests/GHSA-4646-p932-gw34.phpt
+@@ -0,0 +1,35 @@
++--TEST--
++GHSA-4646-p932-gw34: DTD entity references must not outlive their declarations
++--POST--
++<?xml version="1.0" encoding="UTF-8"?>
++<!DOCTYPE Envelope [<!ENTITY e "boom">]>
++<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
++                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
++                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
++                   xmlns:ns1="urn:t">
++  <SOAP-ENV:Header>
++    <h SOAP-ENV:actor="&e;" SOAP-ENV:mustUnderstand="1"/>
++  </SOAP-ENV:Header>
++  <SOAP-ENV:Body>
++    <ns1:echo_><param0 xsi:type="xsd:string">x</param0></ns1:echo_>
++  </SOAP-ENV:Body>
++</SOAP-ENV:Envelope>
++--SKIPIF--
++<?php if (!extension_loaded("soap")) die("skip soap extension required"); ?>
++--FILE--
++<?php
++function echo_($x) {
++    return $x;
++}
++
++$server = new SoapServer(null, [
++    'uri' => 'urn:t',
++    'style' => SOAP_RPC,
++    'use' => SOAP_ENCODED,
++]);
++$server->addFunction('echo_');
++$server->handle();
++?>
++--EXPECT--
++<?xml version="1.0" encoding="UTF-8"?>
++<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>DTD are not supported by SOAP</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/php-cve-2026-129538.patch b/php-cve-2026-129538.patch
new file mode 100644
index 0000000..864784f
--- /dev/null
+++ b/php-cve-2026-129538.patch
@@ -0,0 +1,97 @@
+From: Jakub Zelenka <bukka at php.net>
+Date: Mon, 26 Oct 2026 18:54:31 +0100
+Subject: [PATCH] Fix GHSA-5j3f-64r7-f564: PATH_INFO underflow in CGI init_request_info()
+
+When the suffix stripped from SCRIPT_FILENAME (or PATH_TRANSLATED) is
+longer than PATH_INFO, the re-derived PATH_INFO pointed before the value
+and was then read, written and copied from. Only rewrite PATH_INFO when
+it is longer than the stripped suffix, as FPM has done since the
+CVE-2019-11043 fix.
+
+Backported to 7.1: the test runs a string proc_open() command and uses
+isset() instead of ??.
+
+Origin: backport, https://github.com/php/php-src/commit/964cdcfa5adfa577cde97df89fc8fda04815694d
+Bug: https://github.com/php/php-src/security/advisories/GHSA-5j3f-64r7-f564
+---
+ sapi/cgi/cgi_main.c                     |  4 +--
+ sapi/cgi/tests/ghsa-5j3f-64r7-f564.phpt | 55 +++++++++++++++++++++++++++++++
+ 2 files changed, 57 insertions(+), 2 deletions(-)
+
+diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
+index 777965ab..d36ce849 100644
+--- a/sapi/cgi/cgi_main.c
++++ b/sapi/cgi/cgi_main.c
+@@ -1298,9 +1298,9 @@ static void init_request_info(fcgi_request *request)
+ 						 */
+ 						size_t slen = len - strlen(pt);
+ 						size_t pilen = env_path_info ? strlen(env_path_info) : 0;
+-						char *path_info = env_path_info ? env_path_info + pilen - slen : NULL;
++						char *path_info = (env_path_info && pilen > slen) ? env_path_info + pilen - slen : NULL;
+ 
+-						if (orig_path_info != path_info) {
++						if (path_info && orig_path_info != path_info) {
+ 							if (orig_path_info) {
+ 								char old;
+ 
+diff --git a/sapi/cgi/tests/ghsa-5j3f-64r7-f564.phpt b/sapi/cgi/tests/ghsa-5j3f-64r7-f564.phpt
+new file mode 100644
+index 00000000..8abde1bf
+--- /dev/null
++++ b/sapi/cgi/tests/ghsa-5j3f-64r7-f564.phpt
+@@ -0,0 +1,55 @@
++--TEST--
++GHSA-5j3f-64r7-f564 (PATH_INFO underflow when the stripped suffix is longer than PATH_INFO)
++--SKIPIF--
++<?php include "skipif.inc"; ?>
++--FILE--
++<?php
++include "include.inc";
++
++$php = get_cgi_path();
++$script = __DIR__ . "/ghsa-5j3f-64r7-f564.target.php";
++file_put_contents($script, '<?php var_dump(isset($_SERVER["PATH_INFO"]) ? $_SERVER["PATH_INFO"] : null, isset($_SERVER["ORIG_PATH_INFO"]) ? $_SERVER["ORIG_PATH_INFO"] : null);');
++
++function run_cgi($php, array $env) {
++    $p = proc_open(
++        escapeshellarg($php) . " -n -d cgi.fix_pathinfo=1",
++        [0 => ["pipe", "r"], 1 => ["pipe", "w"]],
++        $pipes,
++        null,
++        $env + ["REDIRECT_STATUS" => "1", "REQUEST_METHOD" => "GET", "PATH" => getenv("PATH")]
++    );
++    fclose($pipes[0]);
++    $out = stream_get_contents($pipes[1]);
++    fclose($pipes[1]);
++    proc_close($p);
++    echo substr($out, strpos($out, "\r\n\r\n") + 4);
++}
++
++echo "Suffix shorter than PATH_INFO\n";
++run_cgi($php, ["SCRIPT_FILENAME" => "$script/b", "PATH_INFO" => "/a/b"]);
++
++echo "Suffix longer than PATH_INFO\n";
++run_cgi($php, ["SCRIPT_FILENAME" => "$script/xxxxxxxxxxxxxxxx", "PATH_INFO" => "/x"]);
++
++echo "Suffix taken from PATH_TRANSLATED\n";
++run_cgi($php, [
++    "SCRIPT_FILENAME" => $php,
++    "PATH_TRANSLATED" => "$script/xxxxxxxxxxxxxxxx",
++    "REDIRECT_URL" => "/redirected",
++    "PATH_INFO" => "/x",
++]);
++?>
++--CLEAN--
++<?php
++ at unlink(__DIR__ . "/ghsa-5j3f-64r7-f564.target.php");
++?>
++--EXPECT--
++Suffix shorter than PATH_INFO
++string(2) "/b"
++string(4) "/a/b"
++Suffix longer than PATH_INFO
++string(2) "/x"
++NULL
++Suffix taken from PATH_TRANSLATED
++string(2) "/x"
++NULL
diff --git a/php-cve-2026-15353.patch b/php-cve-2026-15353.patch
new file mode 100644
index 0000000..e6a0c43
--- /dev/null
+++ b/php-cve-2026-15353.patch
@@ -0,0 +1,265 @@
+From: Alexandre Daubois <alex.daubois at gmail.com>
+Date: Mon, 21 Sep 2026 15:49:40 +0200
+Subject: [PATCH] Fix GHSA-q23r-hr55-xmpg: out-of-bounds read on empty SOAP-ENC:arraySize
+
+An arraySize with no dimension made calc_dimension_12() return 0 and the
+first position of a zero-sized array was read; treat it as one dimension.
+
+Backported to 7.1: the tests use column-0 heredocs, no constructor
+promotion and strpos() instead of str_contains().
+
+Origin: backport, https://github.com/php/php-src/commit/59e46404a744b7ef469f51acd3ee225d518dbaf8
+Bug: https://github.com/php/php-src/security/advisories/GHSA-q23r-hr55-xmpg
+---
+ ext/soap/php_encoding.c                      |  2 +-
+ ext/soap/tests/GHSA-q23r-hr55-xmpg-wsdl.phpt | 83 ++++++++++++++++++++++++++
+ ext/soap/tests/GHSA-q23r-hr55-xmpg-wsdl.wsdl | 67 +++++++++++++++++++++
+ ext/soap/tests/GHSA-q23r-hr55-xmpg.phpt      | 65 ++++++++++++++++++++
+ 4 files changed, 216 insertions(+), 1 deletion(-)
+
+diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
+index f330534c..c265bf18 100644
+--- a/ext/soap/php_encoding.c
++++ b/ext/soap/php_encoding.c
+@@ -2050,7 +2050,7 @@ static int calc_dimension_12(const char* str)
+ 		}
+ 		str++;
+ 	}
+-	return i;
++	return i != 0 ? i : 1;
+ }
+ 
+ static int* get_position_12(int dimension, const char* str)
+diff --git a/ext/soap/tests/GHSA-q23r-hr55-xmpg-wsdl.phpt b/ext/soap/tests/GHSA-q23r-hr55-xmpg-wsdl.phpt
+new file mode 100644
+index 00000000..c7756c20
+--- /dev/null
++++ b/ext/soap/tests/GHSA-q23r-hr55-xmpg-wsdl.phpt
+@@ -0,0 +1,83 @@
++--TEST--
++GHSA-q23r-hr55-xmpg: Unbounded array walk on empty wsdl:arraySize
++--SKIPIF--
++<?php if (!extension_loaded('soap')) die('skip soap extension required'); ?>
++--INI--
++soap.wsdl_cache_enabled=0
++--FILE--
++<?php
++
++const WSDL = __DIR__ . '/GHSA-q23r-hr55-xmpg-wsdl.wsdl';
++
++function itemType() { return ['A', 'B', 'C']; }
++function sizeOnly() { return ['A', 'B', 'C']; }
++
++function request(string $operation): string {
++    return <<<XML
++<?xml version="1.0"?>
++<env:Envelope
++    xmlns:env="http://www.w3.org/2003/05/soap-envelope"
++    xmlns:m="urn:arraysize">
++
++    <env:Body>
++        <m:{$operation}/>
++    </env:Body>
++</env:Envelope>
++XML;
++}
++
++class ReplayClient extends SoapClient
++{
++    public $arrayType;
++
++    public function __construct(string $arrayType) {
++        $this->arrayType = $arrayType;
++        parent::__construct(WSDL);
++    }
++
++    public function __doRequest($request, $location, $action, $version, $oneWay = 0): ?string {
++        return <<<XML
++<?xml version="1.0"?>
++<env:Envelope
++    xmlns:env="http://www.w3.org/2003/05/soap-envelope"
++    xmlns:ns1="urn:arraysize"
++    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
++    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
++
++    <env:Body>
++        <ns1:{$this->arrayType}Response>
++            <result xsi:type="ns1:{$this->arrayType}Array">
++                <item xsi:type="xsd:string">A</item>
++                <item xsi:type="xsd:string">B</item>
++                <item xsi:type="xsd:string">C</item>
++            </result>
++        </ns1:{$this->arrayType}Response>
++    </env:Body>
++</env:Envelope>
++XML;
++    }
++}
++
++$server = new SoapServer(WSDL);
++$server->addFunction(['itemType', 'sizeOnly']);
++
++foreach (['itemType', 'sizeOnly'] as $operation) {
++    ob_start();
++    $server->handle(request($operation));
++    $response = ob_get_clean();
++
++    preg_match('/arraySize="[^"]*"/', $response, $matches);
++    echo 'encode ', $operation, ' => ', $matches[0] ?? 'none', "\n";
++}
++
++foreach (['ItemType', 'SizeOnly'] as $arrayType) {
++    $client = new ReplayClient($arrayType);
++    echo 'decode ', $arrayType, ' => ', json_encode($client->{lcfirst($arrayType)}()), "\n";
++}
++
++?>
++--EXPECT--
++encode itemType => arraySize="3"
++encode sizeOnly => arraySize="3"
++decode ItemType => ["A","B","C"]
++decode SizeOnly => ["A","B","C"]
+diff --git a/ext/soap/tests/GHSA-q23r-hr55-xmpg-wsdl.wsdl b/ext/soap/tests/GHSA-q23r-hr55-xmpg-wsdl.wsdl
+new file mode 100644
+index 00000000..55b5b920
+--- /dev/null
++++ b/ext/soap/tests/GHSA-q23r-hr55-xmpg-wsdl.wsdl
+@@ -0,0 +1,67 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
++             xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
++             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
++             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
++             xmlns:enc12="http://www.w3.org/2003/05/soap-encoding"
++             xmlns:tns="urn:arraysize"
++             targetNamespace="urn:arraysize">
++
++  <types>
++    <xsd:schema targetNamespace="urn:arraysize">
++      <xsd:import namespace="http://www.w3.org/2003/05/soap-encoding"/>
++
++      <xsd:complexType name="ItemTypeArray">
++        <xsd:complexContent>
++          <xsd:restriction base="enc12:Array">
++            <xsd:attribute ref="enc12:itemType" wsdl:itemType="xsd:string"/>
++            <xsd:attribute ref="enc12:arraySize" wsdl:arraySize=""/>
++          </xsd:restriction>
++        </xsd:complexContent>
++      </xsd:complexType>
++
++      <xsd:complexType name="SizeOnlyArray">
++        <xsd:complexContent>
++          <xsd:restriction base="enc12:Array">
++            <xsd:attribute ref="enc12:arraySize" wsdl:arraySize=""/>
++          </xsd:restriction>
++        </xsd:complexContent>
++      </xsd:complexType>
++    </xsd:schema>
++  </types>
++
++  <message name="emptyRequest"/>
++  <message name="itemTypeResponse"><part name="result" type="tns:ItemTypeArray"/></message>
++  <message name="sizeOnlyResponse"><part name="result" type="tns:SizeOnlyArray"/></message>
++
++  <portType name="ArrayPortType">
++    <operation name="itemType">
++      <input message="tns:emptyRequest"/>
++      <output message="tns:itemTypeResponse"/>
++    </operation>
++    <operation name="sizeOnly">
++      <input message="tns:emptyRequest"/>
++      <output message="tns:sizeOnlyResponse"/>
++    </operation>
++  </portType>
++
++  <binding name="ArrayBinding" type="tns:ArrayPortType">
++    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
++    <operation name="itemType">
++      <soap:operation soapAction="itemType"/>
++      <input><soap:body use="encoded" namespace="urn:arraysize" encodingStyle="http://www.w3.org/2003/05/soap-encoding"/></input>
++      <output><soap:body use="encoded" namespace="urn:arraysize" encodingStyle="http://www.w3.org/2003/05/soap-encoding"/></output>
++    </operation>
++    <operation name="sizeOnly">
++      <soap:operation soapAction="sizeOnly"/>
++      <input><soap:body use="encoded" namespace="urn:arraysize" encodingStyle="http://www.w3.org/2003/05/soap-encoding"/></input>
++      <output><soap:body use="encoded" namespace="urn:arraysize" encodingStyle="http://www.w3.org/2003/05/soap-encoding"/></output>
++    </operation>
++  </binding>
++
++  <service name="ArrayService">
++    <port name="ArrayPort" binding="tns:ArrayBinding">
++      <soap:address location="test://"/>
++    </port>
++  </service>
++</definitions>
+diff --git a/ext/soap/tests/GHSA-q23r-hr55-xmpg.phpt b/ext/soap/tests/GHSA-q23r-hr55-xmpg.phpt
+new file mode 100644
+index 00000000..2ea3a310
+--- /dev/null
++++ b/ext/soap/tests/GHSA-q23r-hr55-xmpg.phpt
+@@ -0,0 +1,65 @@
++--TEST--
++GHSA-q23r-hr55-xmpg: Out-of-bounds read on empty SOAP-ENC:arraySize
++--SKIPIF--
++<?php if (!extension_loaded('soap')) die('skip soap extension required'); ?>
++--FILE--
++<?php
++
++function echo_back($data) { $GLOBALS['decoded'][] = $data; return null; }
++
++function request(string $arraySize, string $itemType = ''): string {
++    $itemTypeAttribute = $itemType === '' ? '' : "SOAP-ENC:itemType=\"{$itemType}\"";
++
++    return <<<XML
++<?xml version="1.0"?>
++<SOAP-ENV:Envelope
++    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
++    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
++    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
++    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
++
++    <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
++        <echo_back>
++            <data xsi:type="SOAP-ENC:Array" {$itemTypeAttribute} SOAP-ENC:arraySize="{$arraySize}">
++                <item xsi:type="xsd:string">A</item>
++                <item xsi:type="xsd:string">B</item>
++                <item xsi:type="xsd:string">C</item>
++            </data>
++        </echo_back>
++    </SOAP-ENV:Body>
++</SOAP-ENV:Envelope>
++XML;
++}
++
++function decode(SoapServer $server, string $request): string {
++    ob_start();
++    $server->handle($request);
++    $response = ob_get_clean();
++
++    if (strpos($response, '<SOAP-ENV:Fault>') !== false) {
++        return 'fault: ' . strip_tags($response);
++    }
++
++    return json_encode(array_pop($GLOBALS['decoded']));
++}
++
++$server = new SoapServer(null, ['uri' => 'http://test']);
++$server->addFunction('echo_back');
++
++$GLOBALS['decoded'] = [];
++
++foreach (['', ' ', 'abc', '*', '3', '2 2'] as $arraySize) {
++    echo var_export($arraySize, true), ' => ', decode($server, request($arraySize)), "\n";
++}
++
++echo "itemType => ", decode($server, request('', 'xsd:string')), "\n";
++
++?>
++--EXPECT--
++'' => ["A","B","C"]
++' ' => ["A","B","C"]
++'abc' => ["A","B","C"]
++'*' => ["A","B","C"]
++'3' => ["A","B","C"]
++'2 2' => [["A","B"],["C"]]
++itemType => ["A","B","C"]
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/php.git/commitdiff/96fb5ca522b78de79ab9ed8d6edb345bd16aef1c



More information about the pld-cvs-commit mailing list