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

arekm arekm at pld-linux.org
Thu Nov 19 18:52:21 CET 2026


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

    Rel 20. 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 | 275 ++++++++++++++++++++++++++++++++++++++++
 php-cve-2026-126714.patch |  26 ++++
 php-cve-2026-127960.patch | 168 +++++++++++++++++++++++++
 php-cve-2026-128064.patch | 143 +++++++++++++++++++++
 php-cve-2026-128090.patch | 166 ++++++++++++++++++++++++
 php-cve-2026-129289.patch | 313 ++++++++++++++++++++++++++++++++++++++++++++++
 php-cve-2026-129291.patch |  42 +++++++
 php-cve-2026-129292.patch | 289 ++++++++++++++++++++++++++++++++++++++++++
 php-cve-2026-129474.patch | 189 ++++++++++++++++++++++++++++
 php-cve-2026-129481.patch | 128 +++++++++++++++++++
 php-cve-2026-129496.patch |  33 +++++
 php-cve-2026-129506.patch |  68 ++++++++++
 php-cve-2026-129538.patch |  91 ++++++++++++++
 php-cve-2026-15353.patch  | 263 ++++++++++++++++++++++++++++++++++++++
 php.spec                  |  31 ++++-
 15 files changed, 2224 insertions(+), 1 deletion(-)
---
diff --git a/php.spec b/php.spec
index 7706aa1..5b1d01b 100644
--- a/php.spec
+++ b/php.spec
@@ -150,7 +150,7 @@ Summary(ru.UTF-8):	PHP Версии 7 - язык препроцессирова
 Summary(uk.UTF-8):	PHP Версії 7 - мова препроцесування HTML-файлів, виконувана на сервері
 Name:		%{orgname}%{php_suffix}
 Version:	7.4.33
-Release:	19
+Release:	20
 Epoch:		4
 # All files licensed under PHP version 3.01, except
 # Zend is licensed under Zend
@@ -266,6 +266,21 @@ Patch244:	php-cve-2026-109618-session.patch
 Patch245:	php-cve-2026-109618-delayed-oom.patch
 # Patch219 frees row fields that the result set still owns when a row fails to decode
 Patch246:	php-cve-2025-1218-row-undef.patch
+# Patch247+: PHP 8.2.36 security fixes, plus newer-branch ones that also hit 7.4 (Patch259-260), backported
+Patch247:	php-cve-2026-129538.patch
+Patch248:	php-cve-2026-129496.patch
+Patch249:	php-cve-2026-129289.patch
+Patch250:	php-cve-2026-129292.patch
+Patch251:	php-cve-2026-129291.patch
+Patch252:	php-cve-2026-128090.patch
+Patch253:	php-cve-2026-126714.patch
+Patch254:	php-cve-2026-115560.patch
+Patch255:	php-cve-2026-15353.patch
+Patch256:	php-cve-2026-129506.patch
+Patch257:	php-cve-2026-128064.patch
+Patch258:	php-cve-2026-127960.patch
+Patch259:	php-cve-2026-129474.patch
+Patch260:	php-cve-2026-129481.patch
 # Patch300+: upstream fixes that never reached 7.4, backported
 Patch300:	php-c99-configure.patch
 Patch301:	php-bug66049.patch
@@ -2044,6 +2059,20 @@ cp -p php.ini-production php.ini
 %patch -P244 -p1
 %patch -P245 -p1
 %patch -P246 -p1
+%patch -P247 -p1
+%patch -P248 -p1
+%patch -P249 -p1
+%patch -P250 -p1
+%patch -P251 -p1
+%patch -P252 -p1
+%patch -P253 -p1
+%patch -P254 -p1
+%patch -P255 -p1
+%patch -P256 -p1
+%patch -P257 -p1
+%patch -P258 -p1
+%patch -P259 -p1
+%patch -P260 -p1
 %patch -P300 -p1
 %patch -P301 -p1
 %patch -P302 -p1
diff --git a/php-cve-2026-115560.patch b/php-cve-2026-115560.patch
new file mode 100644
index 0000000..1def388
--- /dev/null
+++ b/php-cve-2026-115560.patch
@@ -0,0 +1,275 @@
+From: Arnaud Le Blanc <arnaud.lb at gmail.com>
+Subject: Fix GHSA-658j-r8rw-q6mx: session.upload_progress.enabled is off by default
+
+CVE-2026-115560. Upload progress written with php_binary/php_serialize and
+read back with the php serializer lets the progress key be unserialized as
+objects. Upload progress is now off by default and session ini settings
+cannot be changed at runtime while it is on.
+
+Backported to 7.4: the check also guards OnUpdateTransSid and
+OnUpdateLazyWrite (8.x uses OnUpdateSessionBool for those); test uses
+get_class() instead of $e::class.
+
+Origin: upstream, https://github.com/php/php-src/commit/3f70f66611583bca4ec18385f7f407e2808fa61f
+
+diff --git a/ext/session/session.c b/ext/session/session.c
+index 06425850..bb954175 100644
+--- a/ext/session/session.c
++++ b/ext/session/session.c
+@@ -98,6 +98,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 int php_session_send_cookie(void);
+@@ -542,6 +548,7 @@ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
+ {
+ 	const ps_module *tmp;
+ 
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 
+@@ -581,6 +588,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
+ {
+ 	const ps_serializer *tmp;
+ 
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 
+@@ -609,6 +617,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
+ 
+ static PHP_INI_MH(OnUpdateTransSid) /* {{{ */
+ {
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 
+@@ -625,6 +634,7 @@ static PHP_INI_MH(OnUpdateTransSid) /* {{{ */
+ 
+ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
+ {
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 
+@@ -659,6 +669,7 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */
+ 
+ static PHP_INI_MH(OnUpdateName) /* {{{ */
+ {
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 
+@@ -686,6 +697,7 @@ static PHP_INI_MH(OnUpdateName) /* {{{ */
+ 
+ static PHP_INI_MH(OnUpdateCookieLifetime) /* {{{ */
+ {
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 	if (atol(ZSTR_VAL(new_value)) < 0) {
+@@ -699,6 +711,7 @@ static PHP_INI_MH(OnUpdateCookieLifetime) /* {{{ */
+ 
+ static PHP_INI_MH(OnUpdateSessionLong) /* {{{ */
+ {
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 	return OnUpdateLong(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
+@@ -708,6 +721,7 @@ static PHP_INI_MH(OnUpdateSessionLong) /* {{{ */
+ 
+ static PHP_INI_MH(OnUpdateSessionString) /* {{{ */
+ {
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 	return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
+@@ -717,6 +731,7 @@ static PHP_INI_MH(OnUpdateSessionString) /* {{{ */
+ 
+ static PHP_INI_MH(OnUpdateSessionBool) /* {{{ */
+ {
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
+@@ -729,6 +744,7 @@ static PHP_INI_MH(OnUpdateSidLength) /* {{{ */
+ 	zend_long val;
+ 	char *endptr = NULL;
+ 
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	val = ZEND_STRTOL(ZSTR_VAL(new_value), &endptr, 10);
+@@ -749,6 +765,7 @@ static PHP_INI_MH(OnUpdateSidBits) /* {{{ */
+ 	zend_long val;
+ 	char *endptr = NULL;
+ 
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	val = ZEND_STRTOL(ZSTR_VAL(new_value), &endptr, 10);
+@@ -767,6 +784,7 @@ static PHP_INI_MH(OnUpdateSidBits) /* {{{ */
+ 
+ static PHP_INI_MH(OnUpdateLazyWrite) /* {{{ */
+ {
++	SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ 	SESSION_CHECK_ACTIVE_STATE;
+ 	SESSION_CHECK_OUTPUT_STATE;
+ 	return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
+@@ -825,7 +843,7 @@ PHP_INI_BEGIN()
+ 
+ 	/* 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",
+@@ -2964,6 +2982,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;
+ 	ps_globals->set_handler = 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..a4127b5
--- /dev/null
+++ b/php-cve-2026-126714.patch
@@ -0,0 +1,26 @@
+From: Ilija Tovilo <ilija.tovilo at me.com>
+Subject: Fix GHSA-fm2m-fjf5-v3cp: RCE via corrupted session file
+
+CVE-2026-126714. ps_files_write() overwrote a larger session in place, so an
+interrupted write left new data followed by the old tail, which the session
+decoder could read as attacker-built objects. Truncate before every write.
+
+Origin: upstream, https://github.com/php/php-src/commit/41c0941ae27d1033129e0e09ce3af034ffee86ba
+
+diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
+index 85910525..700b2b82 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..bd8c1e4
--- /dev/null
+++ b/php-cve-2026-127960.patch
@@ -0,0 +1,168 @@
+From: Jakub Zelenka <bukka at php.net>
+Subject: Fix GHSA-mmf9-xm3v-hg2x: quadratic folded header concatenation
+
+CVE-2026-127960. Every folded response header line copied the whole header
+accumulated so far, so a server sending many continuation lines kept the
+HTTP stream wrapper busy for minutes (regression from the CVE-2025-1217 fix).
+
+Origin: upstream, https://github.com/php/php-src/commit/a303f697268d42f6671c9d4c479ff90bbf301db1
+
+diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
+index bc4efa3b..32bea6c1 100644
+--- a/ext/standard/http_fopen_wrapper.c
++++ b/ext/standard/http_fopen_wrapper.c
+@@ -208,25 +208,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 1 if the current line was folded into the last header line,
++ * otherwise 0.  */
++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. */
+@@ -241,19 +237,18 @@ 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. */
+-			zend_string *extended_header_str = zend_string_alloc(last_header_line_length + 1 + http_folded_header_line_length, 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)[ZSTR_LEN(extended_header_str)] = 0;
+-			zend_string_efree(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;
+ 		}
+ 	}
+ 
++	zend_string *last_header_line_str = smart_str_extract(last_header);
++	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) {
+@@ -265,7 +260,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_efree(last_header_line_str);
+-				return NULL;
++				return 0;
+ 			}
+ 			++last_header_name;
+ 		}
+@@ -283,7 +278,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_efree(last_header_line_str);
+-		return NULL;
++		return 0;
+ 	}
+ 
+ 	zend_bool store_header = 1;
+@@ -308,7 +303,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_efree(last_header_line_str);
+-			return NULL;
++			return 0;
+ 		}
+ 		if (header_info->location_len == 0) {
+ 			header_info->location = emalloc(last_header_value_len + 1);
+@@ -356,7 +351,7 @@ static zend_string *php_stream_http_response_headers_parse(php_stream_wrapper *w
+ 		zend_string_efree(last_header_line_str);
+ 	}
+ 
+-	return NULL;
++	return 0;
+ }
+ 
+ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
+@@ -373,7 +368,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
+ 	zval *ua_zval = NULL, *tmpzval = NULL, ssl_proxy_peer_name;
+ 	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;
+@@ -1018,12 +1013,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;
+@@ -1047,20 +1042,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)) {
+@@ -1189,6 +1184,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..372fd46
--- /dev/null
+++ b/php-cve-2026-128064.patch
@@ -0,0 +1,143 @@
+From: Jakub Zelenka <bukka at php.net>
+Subject: Fix GHSA-f6gg-rchx-xw8j: mixed case HTTPS and FTPS
+
+CVE-2026-128064. TLS was chosen by a lowercase 's' at a fixed position, so
+HTTPS://, httpS:// and FTPS:// URLs (also as redirect targets) were sent in
+plaintext.
+
+Backported to 7.4: tests run their server with proc_open(); the 7.4
+ServerClientTestCase has no address or message passing.
+
+Origin: upstream, https://github.com/php/php-src/commit/cb68a63e8177f9dc25aba23c0d79c7da82ea69db
+
+diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
+index f0467720..f7949a86 100644
+--- a/ext/standard/ftp_fopen_wrapper.c
++++ b/ext/standard/ftp_fopen_wrapper.c
+@@ -147,7 +147,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char
+ 		return NULL;
+ 	}
+ 
+-	use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 3) && ZSTR_VAL(resource->scheme)[3] == 's';
++	use_ssl = resource->scheme && zend_string_equals_literal_ci(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 4a368740..bc4efa3b 100644
+--- a/ext/standard/http_fopen_wrapper.c
++++ b/ext/standard/http_fopen_wrapper.c
+@@ -434,7 +434,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
+ 			request_fulluri = zend_is_true(tmpzval);
+ 		}
+ 
+-		use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 4) && ZSTR_VAL(resource->scheme)[4] == 's';
++		use_ssl = zend_string_equals_literal_ci(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..260691ff
+--- /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);
++    echo stream_socket_get_name($server, false), "\n";
++
++    $conn = stream_socket_accept($server, 10);
++    $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);
++    echo $result, "\n";
++CODE;
++
++$server = proc_open([PHP_BINARY, '-n', '-r', $serverCode], [1 => ['pipe', 'w']], $pipes);
++$addr = trim(fgets($pipes[1]));
++
++$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 stream_get_contents($pipes[1]);
++fclose($pipes[1]);
++proc_close($server);
++?>
++--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..5a5ccfbf
+--- /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);
++    echo stream_socket_get_name($server, false), "\n";
++
++    $conn = stream_socket_accept($server, 10);
++    fwrite($conn, "220 Ready\r\n");
++    $command = stream_get_line($conn, 8192, "\r\n");
++
++    fclose($conn);
++    fclose($server);
++    echo $command, "\n";
++CODE;
++
++$server = proc_open([PHP_BINARY, '-n', '-r', $serverCode], [1 => ['pipe', 'w']], $pipes);
++$addr = trim(fgets($pipes[1]));
++
++var_dump(@fopen("FTPS://$addr/secret", 'r'));
++echo stream_get_contents($pipes[1]);
++fclose($pipes[1]);
++proc_close($server);
++?>
++--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..609c627
--- /dev/null
+++ b/php-cve-2026-128090.patch
@@ -0,0 +1,166 @@
+From: Alexandre Daubois <alex.daubois at gmail.com>
+Subject: Fix GHSA-68fq-fh7h-f8gr: refuse keyless phar signature when .pubkey exists
+
+CVE-2026-128090. The signature type is not covered by the signature, so an
+OpenSSL signed phar could be rewritten with a SHA-256 digest and accepted.
+
+Backported to 7.4: only PHAR_SIG_OPENSSL exists here; test uses SKIPIF
+instead of --EXTENSIONS--.
+
+Origin: upstream, https://github.com/php/php-src/commit/7050cf338092a93e7d4caa4b7dc0bb8771f52a01
+
+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 639f091f..745938f8 100644
+--- a/ext/phar/util.c
++++ b/ext/phar/util.c
+@@ -1506,6 +1506,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..5b85b9e
--- /dev/null
+++ b/php-cve-2026-129289.patch
@@ -0,0 +1,313 @@
+From: Jakub Zelenka <bukka at php.net>
+Subject: Fix GHSA-qc49-hpvq-g2w6: Drain unread request bodies
+
+CVE-2026-129289. An opened but unread php://input stream skipped the drain
+at request end, so with FCGI_KEEP_CONN the rest of the body was parsed as a
+new FastCGI request (request smuggling, PHP_ADMIN_VALUE injection).
+
+Backported to 7.4: tests use strpos() instead of str_contains().
+
+Origin: upstream, https://github.com/php/php-src/commit/28014fd092c7acdafb9c074e735f099893a5ef66
+
+diff --git a/main/SAPI.c b/main/SAPI.c
+index fbf71ffa..c7f27a6c 100644
+--- a/main/SAPI.c
++++ b/main/SAPI.c
+@@ -498,7 +498,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 03c4aaf0..23235bf4 100644
+--- a/main/fastcgi.c
++++ b/main/fastcgi.c
+@@ -1049,6 +1049,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;
+@@ -1312,6 +1316,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..42a9d3e5
+--- /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 = static fn(int $length): string => $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..5bd1ea71
+--- /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 = static fn(int $length): string => $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..b3fc6fc
--- /dev/null
+++ b/php-cve-2026-129291.patch
@@ -0,0 +1,42 @@
+From: "Ian P. Christian" <ian.christian at zoopla.co.uk>
+Subject: Fix GHSA-jm4m-qfqx-967m: FPM worker stdio pipe fd closed twice
+
+CVE-2026-129291. When a worker exits while another process still holds its
+stdout/stderr pipe, the master closes the read end without removing it from
+epoll and frees the child; an inherited copy keeps the epoll watch alive and
+a later write fires the event on the freed child (master UAF, root).
+
+7.4 has no postponed child free (8.1.20+), but frees the child right after
+the close, so the stale watch is the same; the fix is the same as well. The
+upstream test (gh24046) checks the postponed free and is left out.
+
+Origin: upstream, https://github.com/php/php-src/commit/8c38b791449708540fd356ddc6927f463faeca91
+
+diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c
+index 912f77c1..eedc013a 100644
+--- a/sapi/fpm/fpm/fpm_children.c
++++ b/sapi/fpm/fpm/fpm_children.c
+@@ -71,7 +71,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;
+ 		}
+ 	}
+ 
+@@ -80,7 +84,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..7362dce
--- /dev/null
+++ b/php-cve-2026-129292.patch
@@ -0,0 +1,289 @@
+From: Jakub Zelenka <bukka at php.net>
+Subject: Fix GHSA-3mg3-cr28-46gc: FPM XSS within status endpoint via user and script
+
+CVE-2026-129292. The full status page printed the request method, the Basic
+auth user and the script filename unescaped (HTML, XML and JSON output).
+
+Backported to 7.4: ext/json is a shared module here, so JSON values are
+escaped by a local helper instead of php_json_encode_string(); it also covers
+request URI and query string, which the 7.4 fix for CVE-2026-6735 escaped for
+HTML and XML only. The FPM tester gets the 'delay' request option from 8.x;
+the test skips without ext/json.
+
+Origin: upstream, https://github.com/php/php-src/commit/1ecb92f2cdeb235bb10d6c220c9be4a13f527243
+
+diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c
+index 9926ebd6..4922d6a1 100644
+--- a/sapi/fpm/fpm/fpm_status.c
++++ b/sapi/fpm/fpm/fpm_status.c
+@@ -14,6 +14,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;
+@@ -44,6 +45,53 @@ int fpm_status_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
+ }
+ /* }}} */
+ 
++/* ext/json is built shared, so php_json_encode_string() cannot be used here.
++ * Invalid UTF-8 is dropped like with PHP_JSON_INVALID_UTF8_IGNORE. */
++static zend_string *fpm_status_escape_json(const char *str)
++{
++	smart_str buf = {0};
++	size_t len = strlen(str), pos = 0;
++
++	while (pos < len) {
++		size_t start = pos;
++		int status;
++		unsigned int c = php_next_utf8_char((const unsigned char *) str, len, &pos, &status);
++
++		if (status != SUCCESS) {
++			continue;
++		}
++		if (c == '"' || c == '\\') {
++			smart_str_appendc(&buf, '\\');
++			smart_str_appendc(&buf, (char) c);
++		} else if (c < 0x20) {
++			smart_str_append_printf(&buf, "\\u%04x", c);
++		} else {
++			smart_str_appendl(&buf, str + start, pos - start);
++		}
++	}
++	smart_str_0(&buf);
++
++	return buf.s ? buf.s : zend_string_init("", 0, 0);
++}
++
++static char *fpm_status_escape(const char *str, int encode_html, int 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_escape_json(str);
++		return ZSTR_VAL(*tmp);
++	}
++	return (char *) str;
++}
++
+ int fpm_status_export_to_zval(zval *status)
+ {
+ 	struct fpm_scoreboard_s scoreboard, *scoreboard_p;
+@@ -147,7 +195,7 @@ int fpm_status_handle_request(void) /* {{{ */
+ 	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;
+@@ -227,6 +275,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")) {
+@@ -359,6 +408,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 =
+ 				"{"
+@@ -483,8 +533,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;
+@@ -511,33 +563,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 */
+@@ -561,13 +591,13 @@ int fpm_status_handle_request(void) /* {{{ */
+ 					(unsigned long) (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
+@@ -575,12 +605,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..95cfdeb0
+--- /dev/null
++++ b/sapi/fpm/tests/ghsa-3mg3-cr28-46gc-status-xss.phpt
+@@ -0,0 +1,73 @@
++--TEST--
++FPM: GHSA-3mg3-cr28-46gc - status xss via request method, auth user and script filename
++--SKIPIF--
++<?php
++include "skipif.inc";
++if (!extension_loaded("json")) die("skip json extension required");
++?>
++--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/sapi/fpm/tests/tester.inc b/sapi/fpm/tests/tester.inc
+index fe5f0c2f..070cf2f2 100644
+--- a/sapi/fpm/tests/tester.inc
++++ b/sapi/fpm/tests/tester.inc
+@@ -647,6 +647,9 @@ class Tester
+         try {
+             $connections = array_map(function ($requestData) use ($address, $connKeepAlive) {
+                 $client = $this->getClient($address, $connKeepAlive);
++                if (isset($requestData['delay'])) {
++                    usleep($requestData['delay']);
++                }
+                 $params = $this->getRequestParams(
+                     $requestData['query'] ?? '',
+                     $requestData['headers'] ?? [],
diff --git a/php-cve-2026-129474.patch b/php-cve-2026-129474.patch
new file mode 100644
index 0000000..3e8ddda
--- /dev/null
+++ b/php-cve-2026-129474.patch
@@ -0,0 +1,189 @@
+From: Arnaud Le Blanc <arnaud.lb at gmail.com>
+Subject: Fix GHSA-8mjj-2r7p-4hg2: UAF in debug_backtrace_get_args() on trampoline calls
+
+CVE-2026-129474. A backtrace taken while a __call/__callStatic trampoline
+frame is on the stack reads its arguments from behind the CVs/TMPs, where a
+trampoline never moves them (stale or freed values). The advisory lists 8.5
+only (fatal_error_backtraces), but 7.4 has the same code; a pcntl async
+signal handler calling debug_backtrace() reaches it.
+
+Backported to 7.4: the 8.5 fatal_error_backtraces test is replaced by a
+pcntl signal test; phpdbg tests do not set fatal_error_backtraces.
+
+Origin: upstream, https://github.com/php/php-src/commit/03c403286d9440c2b3a840812652be4e221d1be7
+
+diff --git a/Zend/tests/GHSA-8mjj-2r7p-4hg2.phpt b/Zend/tests/GHSA-8mjj-2r7p-4hg2.phpt
+new file mode 100644
+index 00000000..0f5da878
+--- /dev/null
++++ b/Zend/tests/GHSA-8mjj-2r7p-4hg2.phpt
+@@ -0,0 +1,39 @@
++--TEST--
++GHSA-8mjj-2r7p-4hg2: debug_backtrace() args of a __callStatic trampoline frame interrupted by a signal
++--SKIPIF--
++<?php
++if (!extension_loaded("pcntl")) die("skip pcntl extension required");
++if (!extension_loaded("posix")) die("skip posix extension required");
++?>
++--INI--
++zend.exception_ignore_args=0
++--FILE--
++<?php
++class C { static function __callStatic($n, $a) {} }
++$bad = 0; $hits = 0;
++pcntl_async_signals(true);
++pcntl_signal(SIGUSR1, function () use (&$bad, &$hits) {
++    foreach (debug_backtrace() as $f) {
++        if (($f['class'] ?? '') === 'C' && $f['function'] === 'test') {
++            $hits++;
++            if (($f['args'] ?? null) !== [1, 2, 3, 4]) {
++                $bad++;
++            }
++        }
++    }
++});
++$parent = getmypid();
++$child = pcntl_fork();
++if ($child === 0) {
++    pcntl_signal(SIGUSR1, SIG_IGN);
++    for ($i = 0; $i < 100000; $i++) { posix_kill($parent, SIGUSR1); }
++    exit(0);
++}
++for ($n = 0; ; $n++) {
++    C::test(1, 2, 3, 4); C::test(1, 2, 3, 4); C::test(1, 2, 3, 4); C::test(1, 2, 3, 4);
++    if ($n % 256 === 0 && pcntl_waitpid($child, $st, WNOHANG) !== 0) break;
++}
++var_dump($bad);
++?>
++--EXPECT--
++int(0)
+diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
+index 33dfea0e..4f5667ac 100644
+--- a/Zend/zend_builtin_functions.c
++++ b/Zend/zend_builtin_functions.c
+@@ -2113,7 +2113,11 @@ static void debug_backtrace_get_args(zend_execute_data *call, zval *arg_array) /
+ 		array_init_size(arg_array, num_args);
+ 		zend_hash_real_init_packed(Z_ARRVAL_P(arg_array));
+ 		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 0f1f0362..613171a8 100644
+--- a/sapi/phpdbg/phpdbg.c
++++ b/sapi/phpdbg/phpdbg.c
+@@ -156,6 +156,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 912089ea..dd8e3856 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..bdd48373
+--- /dev/null
++++ b/sapi/phpdbg/tests/GHSA-8mjj-2r7p-4hg2-001.phpt
+@@ -0,0 +1,33 @@
++--TEST--
++GHSA-8mjj-2r7p-4hg2: phpdbg frame display for __call trampoline
++--INI--
++zend.exception_ignore_args=1
++--PHPDBG--
++b ZEND_CALL_TRAMPOLINE
++r
++f 1
++f 0
++q
++--EXPECTF--
++[Successful compilation of %s]
++prompt> [Breakpoint #0 added at ZEND_CALL_TRAMPOLINE]
++prompt> [Breakpoint #0 in ZEND_CALL_TRAMPOLINE at %s:0, hits: 1]
++ 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..a27c1635
+--- /dev/null
++++ b/sapi/phpdbg/tests/GHSA-8mjj-2r7p-4hg2-002.phpt
+@@ -0,0 +1,30 @@
++--TEST--
++GHSA-8mjj-2r7p-4hg2: phpdbg backtrace for __call trampoline with attached symbol table
++--INI--
++zend.exception_ignore_args=0
++--PHPDBG--
++b ZEND_CALL_TRAMPOLINE
++r
++i v
++back
++q
++--EXPECTF--
++[Successful compilation of %s]
++prompt> [Breakpoint #0 added at ZEND_CALL_TRAMPOLINE]
++prompt> [Breakpoint #0 in ZEND_CALL_TRAMPOLINE at %s:0, hits: 1]
++ 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..f52e4e8
--- /dev/null
+++ b/php-cve-2026-129481.patch
@@ -0,0 +1,128 @@
+From: Arnaud Le Blanc <arnaud.lb at gmail.com>
+Subject: Fix GHSA-g3vh-838c-65v7: do not continue after an interrupted RSHUTDOWN
+
+CVE-2026-129481. A fatal error inside a module RSHUTDOWN (e.g. a user stream
+closed while session globals are released) skips the rest of the cleanup;
+the next request in the same process then frees stale PS(mod_user_names)
+from the previous request's heap.
+
+Backported to 7.4: Zend part only (7.4 has no PS(session_started_filename));
+7.4 wraps all RSHUTDOWNs in one zend_try, so the catch goes there. FPM test
+uses positional arguments.
+
+Origin: upstream, https://github.com/php/php-src/commit/ad9b44ae611962c8b770ffc962ddff0c30d7d77c
+
+diff --git a/Zend/zend_API.c b/Zend/zend_API.c
+index ac1f09b2..1cae0e49 100644
+--- a/Zend/zend_API.c
++++ b/Zend/zend_API.c
+@@ -2637,6 +2637,9 @@ ZEND_API void zend_deactivate_modules(void) /* {{{ */
+ 				p++;
+ 			}
+ 		}
++	} zend_catch {
++		/* module shutdown is incomplete */
++		_exit(1);
+ 	} zend_end_try();
+ }
+ /* }}} */
+diff --git a/sapi/fpm/tests/ghsa-g3vh-838c-65v7.phpt b/sapi/fpm/tests/ghsa-g3vh-838c-65v7.phpt
+new file mode 100644
+index 00000000..9f230794
+--- /dev/null
++++ b/sapi/fpm/tests/ghsa-g3vh-838c-65v7.phpt
+@@ -0,0 +1,94 @@
++--TEST--
++FPM: GHSA-g3vh-838c-65v7 terminates a worker after interrupted session shutdown
++--SKIPIF--
++<?php
++include "skipif.inc";
++if (!extension_loaded("session")) die("skip session extension required");
++?>
++--FILE--
++<?php
++require_once "tester.inc";
++
++$sessionDir = __DIR__ . '/ghsa-g3vh-838c-65v7.sessions';
++mkdir($sessionDir, 0700);
++
++$cfg = <<<EOT
++[global]
++error_log = {{FILE:LOG}}
++log_level = notice
++[unconfined]
++listen = {{ADDR:UDS}}
++pm = static
++pm.max_children = 1
++php_admin_value[session.save_path] = $sessionDir
++php_admin_flag[opcache.enable] = off
++php_admin_flag[display_errors] = off
++php_admin_flag[log_errors] = off
++EOT;
++
++$code = <<<'PHP'
++<?php
++if ($_SERVER['QUERY_STRING'] !== 'producer') {
++    echo getmypid();
++    return;
++}
++
++class ShutdownStream {
++    public $context;
++    private $fp;
++
++    public function stream_open($path, $mode, $options, &$openedPath) {
++        $this->fp = fopen('/dev/null', 'w');
++        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::class);
++session_id('g3vh' . getmypid());
++session_start();
++$_SESSION['stream'] = fopen('shutdown-test://session', 'w');
++unset($_SESSION);
++
++// Finish the response before the fatal RSHUTDOWN callback runs.
++echo 'producer';
++fastcgi_finish_request();
++PHP;
++
++$tester = new FPM\Tester($cfg, $code);
++$tester->start();
++$tester->expectLogStartNotices();
++$pid = (int) $tester->request('', [], null, '{{ADDR:UDS}}')->getBody();
++$tester->request('producer', [], null, '{{ADDR:UDS}}')->expectBody('producer');
++$tester->expectLogWarning(
++    'child ' . $pid . ' exited with code 1 after \\d+\\.\\d+ seconds from start',
++    'unconfined'
++);
++$tester->expectLogNotice('child \\d+ started', 'unconfined');
++$replacement = (int) $tester->request('', [], null, '{{ADDR:UDS}}')->getBody();
++var_dump($pid > 0 && $replacement > 0 && $replacement !== $pid);
++$tester->terminate();
++$tester->expectLogTerminatingNotices();
++$tester->close();
++?>
++Done
++--EXPECT--
++bool(true)
++Done
++--CLEAN--
++<?php
++require_once "tester.inc";
++FPM\Tester::clean();
++$sessionDir = __DIR__ . '/ghsa-g3vh-838c-65v7.sessions';
++foreach (glob($sessionDir . '/sess_*') as $file) {
++    unlink($file);
++}
++ at rmdir($sessionDir);
++?>
diff --git a/php-cve-2026-129496.patch b/php-cve-2026-129496.patch
new file mode 100644
index 0000000..6bd023b
--- /dev/null
+++ b/php-cve-2026-129496.patch
@@ -0,0 +1,33 @@
+From: Ilija Tovilo <ilija.tovilo at me.com>
+Subject: Fix GHSA-gr4f-wgx5-jpfv: DATEG(tzcache) use-after-free
+
+CVE-2026-129496. A startup diagnostic logged to error_log fills the timezone
+cache from startup memory; an early request diagnostic (max_input_vars) then
+uses the freed cache. Log timestamps are UTC outside an active request.
+
+Backported to 7.4: the zend_test.warn_on_startup knob and its test are left
+out (PLD does not build zend_test).
+
+Origin: upstream, https://github.com/php/php-src/commit/f986c5ca37c0fdc50595d8291a9920a1df23bf38
+
+diff --git a/main/main.c b/main/main.c
+index e07f7ce3..ade7f5c9 100644
+--- a/main/main.c
++++ b/main/main.c
+@@ -914,15 +914,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..df9ba70
--- /dev/null
+++ b/php-cve-2026-129506.patch
@@ -0,0 +1,68 @@
+From: Jakub Zelenka <bukka at php.net>
+Subject: Fix GHSA-4646-p932-gw34: keep SOAP DTD alive during cleanup
+
+CVE-2026-129506. cleanup_xml_node() freed the DTD while attribute values with
+entity references still pointed into it (use after free), and removing it
+also hid the DTD from the SOAP server's "DTD are not supported" check.
+
+Backported to 7.4: test uses SKIPIF instead of --EXTENSIONS--.
+
+Origin: upstream, https://github.com/php/php-src/commit/66db5cda7df3d7a0e1fc7b171bd9ca318fca49fb
+
+diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
+index d2a03c60..26ba9a3d 100644
+--- a/ext/soap/php_xml.c
++++ b/ext/soap/php_xml.c
+@@ -52,6 +52,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..116a3e13
+--- /dev/null
++++ b/ext/soap/tests/GHSA-4646-p932-gw34.phpt
+@@ -0,0 +1,37 @@
++--TEST--
++GHSA-4646-p932-gw34: DTD entity references must not outlive their declarations
++--SKIPIF--
++<?php
++if (!extension_loaded("soap")) die("skip soap extension required");
++?>
++--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>
++--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..69f6a53
--- /dev/null
+++ b/php-cve-2026-129538.patch
@@ -0,0 +1,91 @@
+From: Jakub Zelenka <bukka at php.net>
+Subject: Fix GHSA-5j3f-64r7-f564: PATH_INFO underflow in CGI init_request_info()
+
+CVE-2026-129538. With cgi.fix_pathinfo=1, a stripped SCRIPT_FILENAME or
+PATH_TRANSLATED suffix longer than PATH_INFO makes php-cgi read and write
+before the PATH_INFO buffer.
+
+Origin: upstream, https://github.com/php/php-src/commit/964cdcfa5adfa577cde97df89fc8fda04815694d
+
+diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
+index 5d8ad4f5..4be3b1e1 100644
+--- a/sapi/cgi/cgi_main.c
++++ b/sapi/cgi/cgi_main.c
+@@ -1300,9 +1300,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..cab27ad5
+--- /dev/null
++++ b/sapi/cgi/tests/ghsa-5j3f-64r7-f564.phpt
+@@ -0,0 +1,60 @@
++--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($_SERVER["PATH_INFO"] ?? null, $_SERVER["ORIG_PATH_INFO"] ?? null);');
++
++function run_cgi(string $php, array $env): void {
++    /* Keep what is needed to start the binary (e.g. sanitizer runtime on Windows). */
++    $base_env = array_filter([
++        "PATH" => getenv("PATH"),
++        "SystemRoot" => getenv("SystemRoot"),
++    ], 'is_string');
++    $p = proc_open(
++        [$php, "-n", "-d", "cgi.fix_pathinfo=1"],
++        [0 => ["pipe", "r"], 1 => ["pipe", "w"]],
++        $pipes,
++        null,
++        $env + ["REDIRECT_STATUS" => "1", "REQUEST_METHOD" => "GET"] + $base_env
++    );
++    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..1bc2cb4
--- /dev/null
+++ b/php-cve-2026-15353.patch
@@ -0,0 +1,263 @@
+From: Alexandre Daubois <alex.daubois at gmail.com>
+Subject: Fix GHSA-q23r-hr55-xmpg: out-of-bounds read on empty SOAP-ENC:arraySize
+
+CVE-2026-15353. An arraySize with no dimension gave a zero-sized position
+array whose first element was still read and used as an array key.
+
+Backported to 7.4: tests use SKIPIF, strpos() and a plain property instead
+of --EXTENSIONS--, str_contains() and constructor promotion.
+
+Origin: upstream, https://github.com/php/php-src/commit/59e46404a744b7ef469f51acd3ee225d518dbaf8
+
+diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
+index 96a0b056..56ec4546 100644
+--- a/ext/soap/php_encoding.c
++++ b/ext/soap/php_encoding.c
+@@ -2013,7 +2013,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..ebef3320
+--- /dev/null
++++ b/ext/soap/tests/GHSA-q23r-hr55-xmpg-wsdl.phpt
+@@ -0,0 +1,86 @@
++--TEST--
++GHSA-q23r-hr55-xmpg: Unbounded array walk on empty wsdl:arraySize
++--SKIPIF--
++<?php
++if (!extension_loaded("soap")) die("skip soap extension required");
++if (!extension_loaded("json")) die("skip json 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..b5f870e9
+--- /dev/null
++++ b/ext/soap/tests/GHSA-q23r-hr55-xmpg.phpt
+@@ -0,0 +1,68 @@
++--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");
++if (!extension_loaded("json")) die("skip json 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/1680bff69c084fcee851cc5c9ee729006842d2ea



More information about the pld-cvs-commit mailing list