[packages/php/PHP_5_6] Rel 44. Backport the 2026-11-19 PHP security fixes
arekm
arekm at pld-linux.org
Thu Nov 19 19:09:18 CET 2026
commit 53fed44df03f088f6a4979038c1ee45d90afb634
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Nov 19 19:06:33 2026 +0100
Rel 44. Backport the 2026-11-19 PHP security fixes
session.upload_progress.enabled now defaults to off, as upstream.
Free the header lines the CVE-2025-1217 backport leaked.
Fixes CVE-2026-129538, CVE-2026-129506, CVE-2026-129496,
CVE-2026-129481, CVE-2026-129292, CVE-2026-129291, CVE-2026-129289,
CVE-2026-128064, CVE-2026-127960, CVE-2026-126714, CVE-2026-115560,
CVE-2026-15353.
php-cve-2025-1217.patch | 3 +-
php-cve-2026-115560.patch | 315 +++++++++++++++++++++++++++++++++++++++
php-cve-2026-126714.patch | 31 ++++
php-cve-2026-127960.patch | 241 ++++++++++++++++++++++++++++++
php-cve-2026-128064.patch | 146 ++++++++++++++++++
php-cve-2026-129289.patch | 367 ++++++++++++++++++++++++++++++++++++++++++++++
php-cve-2026-129291.patch | 45 ++++++
php-cve-2026-129292.patch | 282 +++++++++++++++++++++++++++++++++++
php-cve-2026-129481.patch | 117 +++++++++++++++
php-cve-2026-129496.patch | 31 ++++
php-cve-2026-129506.patch | 123 ++++++++++++++++
php-cve-2026-129538.patch | 95 ++++++++++++
php-cve-2026-15353.patch | 268 +++++++++++++++++++++++++++++++++
php.spec | 26 +++-
14 files changed, 2088 insertions(+), 2 deletions(-)
---
diff --git a/php.spec b/php.spec
index 9932112..2ab250c 100644
--- a/php.spec
+++ b/php.spec
@@ -155,7 +155,7 @@ ERROR: You need to select at least one Apache SAPI to build shared modules.
%undefine with_filter
%endif
-%define rel 43
+%define rel 44
%define orgname php
%define ver_suffix 56
%define php_suffix %{!?with_default_php:%{ver_suffix}}
@@ -370,6 +370,18 @@ Patch431: php-bug47925.patch
Patch432: php-gh22761.patch
# PLD-only: text-protocol row fields left untyped when decoding fails, then freed (5.6-specific code)
Patch433: php-mysqlnd-row-uninit-free.patch
+Patch434: php-cve-2026-129538.patch
+Patch435: php-cve-2026-129496.patch
+Patch436: php-cve-2026-129289.patch
+Patch437: php-cve-2026-129292.patch
+Patch438: php-cve-2026-129291.patch
+Patch439: php-cve-2026-126714.patch
+Patch440: php-cve-2026-115560.patch
+Patch441: php-cve-2026-15353.patch
+Patch442: php-cve-2026-129506.patch
+Patch443: php-cve-2026-128064.patch
+Patch444: php-cve-2026-127960.patch
+Patch445: 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}
@@ -2416,6 +2428,18 @@ exit 1
%patch -P431 -p1
%patch -P432 -p1
%patch -P433 -p1
+%patch -P434 -p1
+%patch -P435 -p1
+%patch -P436 -p1
+%patch -P437 -p1
+%patch -P438 -p1
+%patch -P439 -p1
+%patch -P440 -p1
+%patch -P441 -p1
+%patch -P442 -p1
+%patch -P443 -p1
+%patch -P444 -p1
+%patch -P445 -p1
sed -E -i -e '1s,#!\s*/usr/bin/env\s+(.*),#!%{__bindir}\1,' \
run-tests.php
diff --git a/php-cve-2025-1217.patch b/php-cve-2025-1217.patch
index 61e6341..5cac267 100644
--- a/php-cve-2025-1217.patch
+++ b/php-cve-2025-1217.patch
@@ -170,6 +170,7 @@ Reviewed-by: Tim Düsterhus <tim at tideways-gmbh.com>
Origin: https://github.com/php/php-src/commit/d20b4c97a9f883b62b65b82d939c5af9a2028ef1
Bug: https://github.com/php/php-src/security/advisories/GHSA-v8xr-gpvj-cx9g
Bug-Debian: https://security-tracker.debian.org/tracker/CVE-2025-1217
+PLD: a stored header line is handed to the response header zval instead of copied, the copy leaked the line
---
ext/standard/http_fopen_wrapper.c | 341 ++++++++++++++++-----
.../tests/http/ghsa-v8xr-gpvj-cx9g-001.phpt | 49 +++
@@ -355,7 +356,7 @@ index 5e86d0d..8a435c7 100644
+ if (store_header) {
+ zval *http_header;
+ MAKE_STD_ZVAL(http_header);
-+ ZVAL_STRINGL(http_header, *last_header_line, *last_header_line_length, 1);
++ ZVAL_STRINGL(http_header, *last_header_line, *last_header_line_length, 0);
+ zend_hash_next_index_insert(Z_ARRVAL_P(response_header), &http_header, sizeof(zval *), NULL);
+ } else {
+ efree(*last_header_line);
diff --git a/php-cve-2026-115560.patch b/php-cve-2026-115560.patch
new file mode 100644
index 0000000..c230f27
--- /dev/null
+++ b/php-cve-2026-115560.patch
@@ -0,0 +1,315 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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.
+
+Fixes GHSA-658j-r8rw-q6mx
+Fixes CVE-2026-115560
+Backport of https://github.com/php/php-src/commit/3f70f66611583bca4ec18385f7f407e2808fa61f
+
+5.6: no Error class, the INI handlers throw an Exception instead; the generic
+OnUpdateLong/String/Bool of the PHP_INI_ALL session settings get session wrappers
+as in 7.x+, and the 5.x-only session.use_trans_sid, session.hash_function and
+session.entropy_* handlers are guarded too. Test adapted to 5.6 (no ini_restore()
+case: 5.6 does not call the handler of an unmodified entry; session_name() case added).
+---
+diff --git a/ext/session/session.c b/ext/session/session.c
+--- a/ext/session/session.c
++++ b/ext/session/session.c
+@@ -51,6 +51,7 @@
+ #include "ext/standard/php_smart_str.h"
+ #include "ext/standard/url.h"
+ #include "ext/standard/basic_functions.h"
++#include "zend_exceptions.h"
+
+ #include "mod_files.h"
+ #include "mod_user.h"
+@@ -86,6 +87,12 @@ zend_class_entry *php_session_id_iface_entry;
+ return FAILURE; \
+ }
+
++#define SESSION_CHECK_UPLOAD_PROGRESS_STATE \
++ if (PS(rfc1867_enabled) && stage == ZEND_INI_STAGE_RUNTIME) { \
++ zend_throw_exception(NULL, "Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On", 0 TSRMLS_CC); \
++ return FAILURE; \
++ }
++
+ static void php_session_send_cookie(TSRMLS_D);
+
+ /* Dispatched by RINIT and by php_session_destroy */
+@@ -575,6 +582,7 @@ static void php_session_save_current_state(TSRMLS_D) /* {{{ */
+ static PHP_INI_MH(OnUpdateSaveHandler) /* {{{ */
+ {
+ ps_module *tmp;
++ SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ SESSION_CHECK_ACTIVE_STATE;
+
+ tmp = _php_find_ps_module(new_value TSRMLS_CC);
+@@ -605,6 +613,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(new_value TSRMLS_CC);
+@@ -632,6 +641,7 @@ static PHP_INI_MH(OnUpdateSerializer) /* {{{ */
+
+ static PHP_INI_MH(OnUpdateTransSid) /* {{{ */
+ {
++ SESSION_CHECK_UPLOAD_PROGRESS_STATE;
+ SESSION_CHECK_ACTIVE_STATE;
+
+ if (!strncasecmp(new_value, "on", sizeof("on"))) {
+@@ -646,6 +656,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;
+@@ -677,6 +689,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 ((!new_value_length || is_numeric_string(new_value, new_value_length, NULL, NULL, 0))) {
+ int err_type;
+@@ -704,6 +718,8 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
+ long val;
+ char *endptr = NULL;
+
++ SESSION_CHECK_UPLOAD_PROGRESS_STATE;
++
+ #if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH)
+ PS(hash_ops) = NULL;
+ #endif
+@@ -748,6 +764,27 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */
+ }
+ /* }}} */
+
++static PHP_INI_MH(OnUpdateSessionLong) /* {{{ */
++{
++ SESSION_CHECK_UPLOAD_PROGRESS_STATE;
++ return OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
++}
++/* }}} */
++
++static PHP_INI_MH(OnUpdateSessionString) /* {{{ */
++{
++ SESSION_CHECK_UPLOAD_PROGRESS_STATE;
++ return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
++}
++/* }}} */
++
++static PHP_INI_MH(OnUpdateSessionBool) /* {{{ */
++{
++ SESSION_CHECK_UPLOAD_PROGRESS_STATE;
++ return OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
++}
++/* }}} */
++
+ static PHP_INI_MH(OnUpdateRfc1867Freq) /* {{{ */
+ {
+ int tmp;
+@@ -794,38 +831,38 @@ 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.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)
+ #if HAVE_DEV_URANDOM
+- STD_PHP_INI_ENTRY("session.entropy_file", "/dev/urandom", PHP_INI_ALL, OnUpdateString, entropy_file, php_ps_globals, ps_globals)
+- STD_PHP_INI_ENTRY("session.entropy_length", "32", PHP_INI_ALL, OnUpdateLong, entropy_length, php_ps_globals, ps_globals)
++ STD_PHP_INI_ENTRY("session.entropy_file", "/dev/urandom", PHP_INI_ALL, OnUpdateSessionString, entropy_file, php_ps_globals, ps_globals)
++ STD_PHP_INI_ENTRY("session.entropy_length", "32", PHP_INI_ALL, OnUpdateSessionLong, entropy_length, php_ps_globals, ps_globals)
+ #elif HAVE_DEV_ARANDOM
+- STD_PHP_INI_ENTRY("session.entropy_file", "/dev/arandom", PHP_INI_ALL, OnUpdateString, entropy_file, php_ps_globals, ps_globals)
+- STD_PHP_INI_ENTRY("session.entropy_length", "32", PHP_INI_ALL, OnUpdateLong, entropy_length, php_ps_globals, ps_globals)
++ STD_PHP_INI_ENTRY("session.entropy_file", "/dev/arandom", PHP_INI_ALL, OnUpdateSessionString, entropy_file, php_ps_globals, ps_globals)
++ STD_PHP_INI_ENTRY("session.entropy_length", "32", PHP_INI_ALL, OnUpdateSessionLong, entropy_length, php_ps_globals, ps_globals)
+ #else
+- STD_PHP_INI_ENTRY("session.entropy_file", "", PHP_INI_ALL, OnUpdateString, entropy_file, php_ps_globals, ps_globals)
+- STD_PHP_INI_ENTRY("session.entropy_length", "0", PHP_INI_ALL, OnUpdateLong, entropy_length, php_ps_globals, ps_globals)
++ STD_PHP_INI_ENTRY("session.entropy_file", "", PHP_INI_ALL, OnUpdateSessionString, entropy_file, php_ps_globals, ps_globals)
++ STD_PHP_INI_ENTRY("session.entropy_length", "0", PHP_INI_ALL, OnUpdateSessionLong, entropy_length, php_ps_globals, ps_globals)
+ #endif
+- 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.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.hash_function", "0", PHP_INI_ALL, OnUpdateHashFunc)
+- STD_PHP_INI_ENTRY("session.hash_bits_per_character", "4", PHP_INI_ALL, OnUpdateLong, hash_bits_per_character, php_ps_globals, ps_globals)
++ STD_PHP_INI_ENTRY("session.hash_bits_per_character", "4", PHP_INI_ALL, OnUpdateSessionLong, hash_bits_per_character, 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",
+@@ -2451,6 +2488,7 @@ static PHP_GINIT_FUNCTION(ps) /* {{{ */
+ ps_globals->mod = NULL;
+ ps_globals->serializer = NULL;
+ ps_globals->mod_data = NULL;
++ ps_globals->rfc1867_enabled = 0;
+ ps_globals->session_status = php_session_none;
+ ps_globals->default_mod = NULL;
+ ps_globals->mod_user_implemented = 0;
+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
+--- /dev/null
++++ b/ext/session/tests/session_ini_set_upload_progress_enabled.phpt
+@@ -0,0 +1,119 @@
++--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.hash_function=1
++session.hash_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. */
++$names = array(
++ "session.name",
++ "session.serialize_handler",
++ "session.cookie_lifetime",
++ "session.gc_probability",
++ "session.cookie_path",
++ "session.cookie_secure",
++ "session.hash_function",
++ "session.hash_bits_per_character",
++);
++echo "*** Settings applied at startup ***\n";
++foreach ($names 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 (Exception $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.use_trans_sid", "1");
++try_ini_set("session.hash_function", "0");
++try_ini_set("session.hash_bits_per_character", "4");
++
++echo "\n*** Session functions are rejected at runtime ***\n";
++try {
++ var_dump(session_name("PHPSESSID"));
++} catch (Exception $e) {
++ echo get_class($e), ": ", $e->getMessage(), "\n";
++}
++var_dump(ini_get("session.name"));
++
++echo "\n*** Values are unchanged ***\n";
++foreach ($names 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.hash_function='1'
++session.hash_bits_per_character='5'
++
++*** ini_set() is rejected at runtime ***
++Exception: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Exception: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Exception: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Exception: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Exception: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Exception: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Exception: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Exception: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Exception: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Exception: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++Exception: Session ini settings cannot be changed at runtime when session.upload_progress.enabled is On
++
++*** Session functions are rejected at runtime ***
++Exception: 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.hash_function='1'
++session.hash_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..35c7237
--- /dev/null
+++ b/php-cve-2026-126714.patch
@@ -0,0 +1,31 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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().
+
+Fixes GHSA-fm2m-fjf5-v3cp
+Fixes CVE-2026-126714
+Backport of https://github.com/php/php-src/commit/41c0941ae27d1033129e0e09ce3af034ffee86ba
+---
+diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
+--- a/ext/session/mod_files.c
++++ b/ext/session/mod_files.c
+@@ -413,10 +413,9 @@ PS_WRITE_FUNC(files)
+ return FAILURE;
+ }
+
+- /* Truncate file if the amount of new data is smaller than the existing data set. */
+-
+- if (vallen < (int)data->st_size) {
+- php_ignore_value(ftruncate(data->fd, 0));
++ if (ftruncate(data->fd, 0) != 0) {
++ php_error_docref(NULL TSRMLS_CC, 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..aab8f0a
--- /dev/null
+++ b/php-cve-2026-127960.patch
@@ -0,0 +1,241 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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.
+
+Fixes GHSA-mmf9-xm3v-hg2x
+Fixes CVE-2026-127960
+Backport of https://github.com/php/php-src/commit/a303f697268d42f6671c9d4c479ff90bbf301db1
+
+5.6: applies to the Freexian backport of the CVE-2025-1217 header folding
+(php-cve-2025-1217.patch); the smart_str is freed on the error paths too.
+---
+diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
+--- a/ext/standard/http_fopen_wrapper.c
++++ b/ext/standard/http_fopen_wrapper.c
+@@ -214,23 +214,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 char *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,
+- char **last_header_line, size_t *last_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_end = *last_header_line + *last_header_line_length - 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;
++ return 1;
+ }
+
+ /* Process folding headers if starting with a space or a tab. */
+@@ -245,33 +243,33 @@ static char *php_stream_http_response_headers_parse(php_stream_wrapper *wrapper,
+ /* 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;
+- char *extended_header = emalloc(len + 1);
+- strncpy(extended_header, *last_header_line, *last_header_line_length);
+- extended_header[*last_header_line_length] = ' ';
+- strncpy(extended_header + *last_header_line_length + 1, http_folded_header_line, http_folded_header_line_length);
+- extended_header[len] = '\0';
+- efree(*last_header_line);
+- *last_header_line = extended_header;
+- *last_header_line_length = len;
+- /* Return new header line. */
+- return *last_header_line;
++ /* 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;
+ }
+ }
+
++ /* Take over the finished header line. */
++ smart_str_0(last_header);
++ char *last_header_line = last_header->c;
++ size_t last_header_line_length = last_header->len;
++ char *last_header_line_end = last_header_line + last_header_line_length - 1;
++ last_header->c = NULL;
++ last_header->len = last_header->a = 0;
++
+ /* Find header separator position. */
+- char *last_header_value = memchr(*last_header_line, ':', *last_header_line_length);
++ char *last_header_value = memchr(last_header_line, ':', last_header_line_length);
+ if (last_header_value) {
+ /* Verify there is no space in header name */
+- char *last_header_name = *last_header_line + 1;
++ char *last_header_name = last_header_line + 1;
+ while (last_header_name < last_header_value) {
+ if (*last_header_name == ' ' || *last_header_name == '\t') {
+ header_info->error = 1;
+ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC,
+ "HTTP invalid response format (space in header name)!");
+- efree(*last_header_line);
+- return NULL;
++ efree(last_header_line);
++ return 0;
+ }
+ ++last_header_name;
+ }
+@@ -288,14 +286,14 @@ static char *php_stream_http_response_headers_parse(php_stream_wrapper *wrapper,
+ header_info->error = 1;
+ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC,
+ "HTTP invalid response format (no colon in header line)!");
+- efree(*last_header_line);
+- return NULL;
++ efree(last_header_line);
++ return 0;
+ }
+
+ zend_bool store_header = 1;
+ zval **tmpzval = NULL;
+
+- if (!strncasecmp(*last_header_line, "Location:", sizeof("Location:")-1)) {
++ if (!strncasecmp(last_header_line, "Location:", sizeof("Location:")-1)) {
+ /* Check if the location should be followed. */
+ if (context && php_stream_context_get_option(context, "http", "follow_location", &tmpzval) == SUCCESS) {
+ SEPARATE_ZVAL(tmpzval);
+@@ -315,8 +313,8 @@ static char *php_stream_http_response_headers_parse(php_stream_wrapper *wrapper,
+ php_stream_wrapper_log_error(wrapper, options TSRMLS_CC,
+ "HTTP Location header size is over the limit of %d bytes",
+ HTTP_HEADER_MAX_LOCATION_SIZE);
+- efree(*last_header_line);
+- return NULL;
++ efree(last_header_line);
++ return 0;
+ }
+ if (header_info->location_len == 0) {
+ header_info->location = emalloc(last_header_value_len + 1);
+@@ -325,13 +323,13 @@ static char *php_stream_http_response_headers_parse(php_stream_wrapper *wrapper,
+ }
+ header_info->location_len = last_header_value_len;
+ memcpy(header_info->location, last_header_value, last_header_value_len + 1);
+- } else if (!strncasecmp(*last_header_line, "Content-Type:", sizeof("Content-Type:")-1)) {
++ } else if (!strncasecmp(last_header_line, "Content-Type:", sizeof("Content-Type:")-1)) {
+ php_stream_notify_info(context, PHP_STREAM_NOTIFY_MIME_TYPE_IS, last_header_value, 0);
+- } else if (!strncasecmp(*last_header_line, "Content-Length:", sizeof("Content-Length:")-1)) {
++ } else if (!strncasecmp(last_header_line, "Content-Length:", sizeof("Content-Length:")-1)) {
+ header_info->file_size = atoi(last_header_value);
+- php_stream_notify_file_size(context, header_info->file_size, *last_header_line, 0);
++ php_stream_notify_file_size(context, header_info->file_size, last_header_line, 0);
+ } else if (
+- !strncasecmp(*last_header_line, "Transfer-Encoding:", sizeof("Transfer-Encoding:")-1)
++ !strncasecmp(last_header_line, "Transfer-Encoding:", sizeof("Transfer-Encoding:")-1)
+ && !strncasecmp(last_header_value, "Chunked", sizeof("Chunked")-1)
+ ) {
+ /* Create filter to decode response body. */
+@@ -361,13 +359,13 @@ static char *php_stream_http_response_headers_parse(php_stream_wrapper *wrapper,
+ if (store_header) {
+ zval *http_header;
+ MAKE_STD_ZVAL(http_header);
+- ZVAL_STRINGL(http_header, *last_header_line, *last_header_line_length, 0);
++ ZVAL_STRINGL(http_header, last_header_line, last_header_line_length, 0);
+ zend_hash_next_index_insert(Z_ARRVAL_P(response_header), &http_header, sizeof(zval *), NULL);
+ } else {
+- efree(*last_header_line);
++ efree(last_header_line);
+ }
+
+- return NULL;
++ return 0;
+ }
+
+ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
+@@ -387,7 +385,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
+ zval *response_header = NULL;
+ int reqok = 0;
+ char *http_header_line = NULL;
+- char *last_header_line = NULL;
++ smart_str last_header = {0};
+ php_stream_http_response_header_info header_info;
+ char tmp_line[128];
+ size_t chunk_size = 0;
+@@ -1019,7 +1017,6 @@ finish:
+ }
+
+ /* read past HTTP headers */
+- size_t last_header_line_len = 0;
+ while (!body && !php_stream_eof(stream)) {
+ size_t http_header_line_length;
+
+@@ -1043,13 +1040,13 @@ finish:
+ last_line = 0;
+ }
+
+- if (last_header_line != NULL) {
++ if (last_header.c != NULL) {
+ /* Parse last header line. */
+- last_header_line = php_stream_http_response_headers_parse(wrapper, stream,
+- context, options, &last_header_line, &last_header_line_len,
++ 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 == NULL)) {
++ if (EXPECTED(!folded)) {
+ if (UNEXPECTED(header_info.error)) {
+ php_stream_close(stream);
+ stream = NULL;
+@@ -1073,23 +1070,20 @@ finish:
+ }
+ if (last_line) {
+ /* For the last line the last header line must be NULL. */
+- assert(last_header_line == NULL);
++ assert(last_header.c == NULL);
+ break;
+ }
+ /* Save current line as the last line so it gets parsed in the next round. */
+- last_header_line = emalloc(http_header_line_length + 1);
+- strncpy(last_header_line, http_header_line, http_header_line_length);
+- last_header_line[http_header_line_length] = '\0';
+- last_header_line_len = http_header_line_length;
++ 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 != NULL) {
+- last_header_line = php_stream_http_response_headers_parse(wrapper, stream, context,
+- options, &last_header_line, &last_header_line_len,
++ if (last_header.c != NULL) {
++ php_stream_http_response_headers_parse(wrapper, stream, context,
++ options, &last_header,
+ NULL, NULL, response_code, response_header, &header_info);
+ }
+
+@@ -1208,6 +1202,8 @@ finish:
+ }
+ }
+ out:
++ smart_str_free(&last_header);
++
+ if (protocol_version) {
+ efree(protocol_version);
+ }
diff --git a/php-cve-2026-128064.patch b/php-cve-2026-128064.patch
new file mode 100644
index 0000000..350c9b1
--- /dev/null
+++ b/php-cve-2026-128064.patch
@@ -0,0 +1,146 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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.
+
+Fixes GHSA-f6gg-rchx-xw8j
+Fixes CVE-2026-128064
+Backport of https://github.com/php/php-src/commit/cb68a63e8177f9dc25aba23c0d79c7da82ea69db
+
+5.6: the tests run the plaintext server in a php -n child instead of ServerClientTestCase.
+---
+diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
+--- 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") == 0;
+
+ /* 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
+--- a/ext/standard/http_fopen_wrapper.c
++++ b/ext/standard/http_fopen_wrapper.c
+@@ -448,7 +448,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
+ zval_dtor(&ztmp);
+ }
+
+- use_ssl = resource->scheme && (strlen(resource->scheme) > 4) && resource->scheme[4] == 's';
++ use_ssl = resource->scheme && strcasecmp(resource->scheme, "https") == 0;
+ /* 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
+--- /dev/null
++++ b/ext/standard/tests/http/ghsa-f6gg-rchx-xw8j.phpt
+@@ -0,0 +1,62 @@
++--TEST--
++GHSA-f6gg-rchx-xw8j: mixed-case HTTPS URLs must use TLS
++--SKIPIF--
++<?php
++if (!extension_loaded('openssl')) die('skip openssl extension not loaded');
++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";
++flush();
++
++$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(escapeshellarg(getenv('TEST_PHP_EXECUTABLE')) . ' -n -r ' . escapeshellarg($serverCode),
++ array(1 => array('pipe', 'w')), $pipes);
++$addr = trim(fgets($pipes[1]));
++
++$context = stream_context_create(array(
++ 'http' => array(
++ 'method' => 'POST',
++ 'content' => 'opensec-sensitive-body',
++ 'header' => "X-Opensec-Request: validation\r\n",
++ ),
++ 'ssl' => array(
++ '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
+--- /dev/null
++++ b/ext/standard/tests/streams/ghsa-f6gg-rchx-xw8j.phpt
+@@ -0,0 +1,35 @@
++--TEST--
++GHSA-f6gg-rchx-xw8j: mixed-case FTPS URLs must enable TLS
++--SKIPIF--
++<?php
++if (!extension_loaded('openssl')) die('skip openssl extension not loaded');
++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";
++flush();
++
++$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(escapeshellarg(getenv('TEST_PHP_EXECUTABLE')) . ' -n -r ' . escapeshellarg($serverCode),
++ array(1 => array('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-129289.patch b/php-cve-2026-129289.patch
new file mode 100644
index 0000000..68f318e
--- /dev/null
+++ b/php-cve-2026-129289.patch
@@ -0,0 +1,367 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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.
+
+Fixes GHSA-qc49-hpvq-g2w6
+Fixes CVE-2026-129289
+Backport of https://github.com/php/php-src/commit/28014fd092c7acdafb9c074e735f099893a5ef66
+
+5.6: php://input is lazy since 5.6.0, so the SAPI.c part applies; fastcgi.c exists
+twice (sapi/cgi, sapi/fpm) and both get the guard. The upstream FPM tests are
+ported to the run_fpm() harness of 5.6.
+---
+diff --git a/main/SAPI.c b/main/SAPI.c
+--- a/main/SAPI.c
++++ b/main/SAPI.c
+@@ -519,7 +519,8 @@ SAPI_API void sapi_deactivate(TSRMLS_D)
+ 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/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c
+--- a/sapi/cgi/fastcgi.c
++++ b/sapi/cgi/fastcgi.c
+@@ -885,6 +885,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->closed = 0;
+ req->in_len = 0;
+@@ -1140,6 +1144,8 @@ static inline 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;
+ }
+ }
+
+diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c
+--- a/sapi/fpm/fpm/fastcgi.c
++++ b/sapi/fpm/fpm/fastcgi.c
+@@ -510,6 +510,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->closed = 0;
+ req->in_len = 0;
+@@ -762,6 +766,8 @@ void fcgi_close(fcgi_request *req, int force, int destroy)
+ close(req->fd);
+ #endif
+ req->fd = -1;
++ /* a partially read STDIN record does not outlive its connection */
++ req->in_len = 0;
+ fpm_request_finished();
+ }
+ }
+diff --git a/sapi/fpm/tests/unread-body-keep-conn.phpt b/sapi/fpm/tests/unread-body-keep-conn.phpt
+new file mode 100644
+--- /dev/null
++++ b/sapi/fpm/tests/unread-body-keep-conn.phpt
+@@ -0,0 +1,136 @@
++--TEST--
++FPM: unread request body cannot become a new request on a kept connection
++--SKIPIF--
++<?php include "skipif.inc"; ?>
++--FILE--
++<?php
++
++include "include.inc";
++
++function record($type, $content, $id)
++{
++ return pack('CCnnCC', 1, $type, $id, strlen($content), 0, 0) . $content;
++}
++
++function params(array $params)
++{
++ $encoded = '';
++ $encodeLength = function ($length) {
++ 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($id, $keep, array $params, $stdin)
++{
++ 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($port, $request)
++{
++ $socket = fsockopen('127.0.0.1', $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;
++}
++
++$logfile = dirname(__FILE__) . '/unread-body-keep-conn.log.tmp';
++$script = dirname(__FILE__) . '/unread-body-keep-conn.tmp.php';
++/* a free port, so that parallel test runs do not collide */
++$sock = stream_socket_server('tcp://127.0.0.1:0');
++$port = (int) substr(strrchr(stream_socket_get_name($sock, false), ':'), 1);
++fclose($sock);
++
++$cfg = <<<EOT
++[global]
++error_log = $logfile
++[unconfined]
++listen = 127.0.0.1:$port
++pm = static
++pm.max_children = 1
++catch_workers_output = yes
++EOT;
++
++$code = <<<'PHP'
++<?php
++if ($_SERVER['REMOTE_ADDR'] === '203.0.113.1') {
++ echo "smuggled\n";
++} else {
++ $input = fopen('php://input', 'r');
++ echo "outer\n";
++}
++PHP;
++file_put_contents($script, $code);
++
++$fpm = run_fpm($cfg, $tail);
++if (is_resource($fpm)) {
++ fpm_display_log($tail, 2);
++
++ $hiddenParams = array(
++ '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 = array(
++ '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 (array(false, true) as $keep) {
++ $response = transact($port, 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($port, request(1, true, $outerParams, $body));
++ echo 'partial frame: ',
++ (strpos($response, 'smuggled') !== false) ? 'smuggled' : 'safe', "\n";
++
++ proc_terminate($fpm);
++ stream_get_contents($tail);
++ fclose($tail);
++ proc_close($fpm);
++}
++?>
++--EXPECTF--
++[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d
++[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections
++keep off: safe
++keep on: safe
++partial frame: safe
++--CLEAN--
++<?php
++ at unlink(dirname(__FILE__) . '/unread-body-keep-conn.log.tmp');
++ at unlink(dirname(__FILE__) . '/unread-body-keep-conn.tmp.php');
++?>
+diff --git a/sapi/fpm/tests/unread-body-partial-record.phpt b/sapi/fpm/tests/unread-body-partial-record.phpt
+new file mode 100644
+--- /dev/null
++++ b/sapi/fpm/tests/unread-body-partial-record.phpt
+@@ -0,0 +1,138 @@
++--TEST--
++FPM: partially read STDIN record does not make the worker reject later connections
++--SKIPIF--
++<?php include "skipif.inc"; ?>
++--FILE--
++<?php
++
++include "include.inc";
++
++function record($type, $content, $id)
++{
++ return pack('CCnnCC', 1, $type, $id, strlen($content), 0, 0) . $content;
++}
++
++function params(array $params)
++{
++ $encoded = '';
++ $encodeLength = function ($length) {
++ 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($id, $keep, array $params, $stdin)
++{
++ 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($port, $request)
++{
++ $socket = fsockopen('127.0.0.1', $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;
++}
++
++$logfile = dirname(__FILE__) . '/unread-body-partial-record.log.tmp';
++$script = dirname(__FILE__) . '/unread-body-partial-record.tmp.php';
++/* a free port, so that parallel test runs do not collide */
++$sock = stream_socket_server('tcp://127.0.0.1:0');
++$port = (int) substr(strrchr(stream_socket_get_name($sock, false), ':'), 1);
++fclose($sock);
++
++$cfg = <<<EOT
++[global]
++error_log = $logfile
++[unconfined]
++listen = 127.0.0.1:$port
++pm = static
++pm.max_children = 1
++catch_workers_output = yes
++EOT;
++
++$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;
++file_put_contents($script, $code);
++
++$fpm = run_fpm($cfg, $tail);
++if (is_resource($fpm)) {
++ fpm_display_log($tail, 2);
++
++ $hiddenParams = array(
++ '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 = array(
++ '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 = array('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 (array(false, true) as $keep) {
++ $response = transact($port, 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 (array(1, 2) as $n) {
++ $response = transact($port, request(1, false, $plainParams, ''));
++ echo " next connection $n: ", (strpos($response, 'outer 0') !== false) ? 'served' : 'not served', "\n";
++ }
++ }
++
++ proc_terminate($fpm);
++ stream_get_contents($tail);
++ fclose($tail);
++ proc_close($fpm);
++}
++?>
++--EXPECTF--
++[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d
++[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections
++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
++ at unlink(dirname(__FILE__) . '/unread-body-partial-record.log.tmp');
++ at unlink(dirname(__FILE__) . '/unread-body-partial-record.tmp.php');
++?>
diff --git a/php-cve-2026-129291.patch b/php-cve-2026-129291.patch
new file mode 100644
index 0000000..ecf1fa7
--- /dev/null
+++ b/php-cve-2026-129291.patch
@@ -0,0 +1,45 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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
+
+Backport of the GH-24046 fix (cd161267c0d2ca293b6959114d7c68867273bbda).
+
+Co-authored-by: ndossche <7771979+ndossche at users.noreply.github.com>
+
+Fixes GHSA-jm4m-qfqx-967m
+Fixes CVE-2026-129291
+Backport of https://github.com/php/php-src/commit/8c38b791449708540fd356ddc6927f463faeca91
+
+5.6: there is no delayed cleanup, fpm_child_close() frees the child record right
+away, so a watch left behind by the EAGAIN path pointed at freed memory directly.
+The upstream test needs the FPM\Tester harness and the delayed child cleanup of 8.x; not ported.
+---
+diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c
+--- a/sapi/fpm/fpm/fpm_children.c
++++ b/sapi/fpm/fpm/fpm_children.c
+@@ -69,7 +69,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;
+ }
+ }
+
+@@ -78,7 +82,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..a871f3f
--- /dev/null
+++ b/php-cve-2026-129292.patch
@@ -0,0 +1,282 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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.
+
+Fixes GHSA-3mg3-cr28-46gc
+Fixes CVE-2026-129292
+Backport of https://github.com/php/php-src/commit/1ecb92f2cdeb235bb10d6c220c9be4a13f527243
+
+5.6: the JSON status output had no escaping at all and ext/json can be a shared
+module, so the JSON branch escapes quote, backslash and control characters itself.
+The upstream test is ported to the run_fpm() harness of 5.6.
+---
+diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c
+--- a/sapi/fpm/fpm/fpm_status.c
++++ b/sapi/fpm/fpm/fpm_status.c
+@@ -16,6 +16,7 @@
+ #include "fpm_conf.h"
+ #include "fpm_php.h"
+ #include <ext/standard/html.h>
++#include <ext/standard/php_smart_str.h>
+
+ static char *fpm_status_uri = NULL;
+ static char *fpm_status_ping_uri = NULL;
+@@ -46,6 +47,48 @@ int fpm_status_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
+ }
+ /* }}} */
+
++#define FPM_STATUS_ENCODE_HTML 1
++#define FPM_STATUS_ENCODE_JSON 2
++
++/* Returns NULL for an empty field; *tmp is set when the result has to be freed. */
++static char *fpm_status_escape(char *str, int encode, char **tmp TSRMLS_DC) /* {{{ */
++{
++ size_t len;
++
++ *tmp = NULL;
++ if (str[0] == '\0') {
++ return NULL;
++ }
++ if (encode == FPM_STATUS_ENCODE_HTML) {
++ *tmp = php_escape_html_entities_ex((unsigned char *) str, strlen(str), &len, 1, ENT_DISALLOWED | ENT_HTML_DOC_XML1 | ENT_COMPAT, NULL, 1 TSRMLS_CC);
++ return *tmp;
++ }
++ if (encode == FPM_STATUS_ENCODE_JSON) {
++ /* ext/json may be a shared module, so escape the string body here */
++ smart_str buf = {0};
++ unsigned char *p;
++
++ for (p = (unsigned char *) str; *p; p++) {
++ if (*p == '"' || *p == '\\') {
++ smart_str_appendc(&buf, '\\');
++ smart_str_appendc(&buf, *p);
++ } else if (*p < 0x20) {
++ char hex[7];
++
++ snprintf(hex, sizeof(hex), "\\u%04x", *p);
++ smart_str_appendl(&buf, hex, 6);
++ } else {
++ smart_str_appendc(&buf, *p);
++ }
++ }
++ smart_str_0(&buf);
++ *tmp = buf.c;
++ return *tmp;
++ }
++ return str;
++}
++/* }}} */
++
+ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
+ {
+ struct fpm_scoreboard_s scoreboard, *scoreboard_p;
+@@ -135,7 +178,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
+ if (fpm_php_get_string_from_table("_GET", "html" TSRMLS_CC)) {
+ sapi_add_header_ex(ZEND_STRL("Content-Type: text/html"), 1, 1 TSRMLS_CC);
+ time_format = "%d/%b/%Y:%H:%M:%S %z";
+- encode = 1;
++ encode = FPM_STATUS_ENCODE_HTML;
+
+ short_syntax =
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
+@@ -210,7 +253,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
+ } else if (fpm_php_get_string_from_table("_GET", "xml" TSRMLS_CC)) {
+ sapi_add_header_ex(ZEND_STRL("Content-Type: text/xml"), 1, 1 TSRMLS_CC);
+ time_format = "%s";
+- encode = 1;
++ encode = FPM_STATUS_ENCODE_HTML;
+
+ short_syntax =
+ "<?xml version=\"1.0\" ?>\n"
+@@ -262,6 +305,7 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
+ } else if (fpm_php_get_string_from_table("_GET", "json" TSRMLS_CC)) {
+ sapi_add_header_ex(ZEND_STRL("Content-Type: application/json"), 1, 1 TSRMLS_CC);
+ time_format = "%s";
++ encode = FPM_STATUS_ENCODE_JSON;
+
+ short_syntax =
+ "{"
+@@ -384,8 +428,10 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
+ /* no need to test the var 'full' */
+ if (full_syntax) {
+ int i, first;
+- size_t len, len_uri;
+- char *query_string, *request_uri_string;
++ char *request_method_str, *request_uri_str, *query_string;
++ char *auth_user_str, *script_filename_str;
++ char *tmp_request_method, *tmp_request_uri, *tmp_query_string;
++ char *tmp_auth_user, *tmp_script_filename;
+ struct timeval duration, now;
+ #ifdef HAVE_FPM_LQ
+ float cpu;
+@@ -412,24 +458,11 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
+ }
+ }
+
+- request_uri_string = NULL;
+- len_uri = 0;
+- if (proc.request_uri[0] != '\0') {
+- if (!encode) {
+- request_uri_string = proc.request_uri;
+- } else {
+- request_uri_string = php_escape_html_entities_ex((unsigned char *)proc.request_uri, strlen(proc.request_uri), &len_uri, 1, ENT_DISALLOWED | ENT_HTML_DOC_XML1 | ENT_COMPAT, NULL, 1 TSRMLS_CC);
+- }
+- }
+- query_string = NULL;
+- len = 0;
+- if (proc.query_string[0] != '\0') {
+- if (!encode) {
+- query_string = proc.query_string;
+- } else {
+- query_string = php_escape_html_entities_ex((unsigned char *)proc.query_string, strlen(proc.query_string), &len, 1, ENT_DISALLOWED | ENT_HTML_DOC_XML1 | ENT_COMPAT, NULL, 1 TSRMLS_CC);
+- }
+- }
++ request_method_str = fpm_status_escape(proc.request_method, encode, &tmp_request_method TSRMLS_CC);
++ request_uri_str = fpm_status_escape(proc.request_uri, encode, &tmp_request_uri TSRMLS_CC);
++ query_string = fpm_status_escape(proc.query_string, encode, &tmp_query_string TSRMLS_CC);
++ auth_user_str = fpm_status_escape(proc.auth_user, encode, &tmp_auth_user TSRMLS_CC);
++ script_filename_str = fpm_status_escape(proc.script_filename, encode, &tmp_script_filename TSRMLS_CC);
+
+ #ifdef HAVE_FPM_LQ
+ /* prevent NaN */
+@@ -453,13 +486,13 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
+ now_epoch - proc.start_epoch,
+ proc.requests,
+ duration.tv_sec * 1000000UL + duration.tv_usec,
+- proc.request_method[0] != '\0' ? proc.request_method : "-",
+- request_uri_string ? request_uri_string: "-",
++ request_method_str ? request_method_str : "-",
++ request_uri_str ? request_uri_str : "-",
+ 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_str ? auth_user_str : "-",
++ script_filename_str ? script_filename_str : "-",
+ #ifdef HAVE_FPM_LQ
+ proc.request_stage == FPM_REQUEST_ACCEPTING ? cpu : 0.,
+ #endif
+@@ -467,11 +500,20 @@ int fpm_status_handle_request(TSRMLS_D) /* {{{ */
+ PUTS(buffer);
+ efree(buffer);
+
+- if (len > 0 && query_string) {
+- efree(query_string);
++ if (tmp_request_method) {
++ efree(tmp_request_method);
++ }
++ if (tmp_request_uri) {
++ efree(tmp_request_uri);
++ }
++ if (tmp_query_string) {
++ efree(tmp_query_string);
++ }
++ if (tmp_auth_user) {
++ efree(tmp_auth_user);
+ }
+- if (len_uri > 0 && request_uri_string) {
+- efree(request_uri_string);
++ if (tmp_script_filename) {
++ efree(tmp_script_filename);
+ }
+ }
+
+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
+--- /dev/null
++++ b/sapi/fpm/tests/ghsa-3mg3-cr28-46gc-status-xss.phpt
+@@ -0,0 +1,86 @@
++--TEST--
++FPM: GHSA-3mg3-cr28-46gc - status xss via request method, auth user and script filename
++--SKIPIF--
++<?php include "skipif.inc"; ?>
++--FILE--
++<?php
++
++include "include.inc";
++
++$logfile = dirname(__FILE__).'/php-fpm.log.tmp';
++/* a free port, so that parallel test runs do not collide */
++$sock = stream_socket_server('tcp://127.0.0.1:0');
++$port = (int) substr(strrchr(stream_socket_get_name($sock, false), ':'), 1);
++fclose($sock);
++
++$cfg = <<<EOT
++[global]
++error_log = $logfile
++[unconfined]
++listen = 127.0.0.1:$port
++pm.status_path = /status
++pm = static
++pm.max_children = 2
++EOT;
++
++$scriptFilename = dirname(__FILE__) . '/ghsa-3mg3-cr28-46gc-<svg>.php';
++file_put_contents($scriptFilename, "<?php usleep(500000); echo 'ok';\n");
++
++$fpm = run_fpm($cfg, $tail);
++if (is_resource($fpm)) {
++ fpm_display_log($tail, 2);
++ try {
++ require_once 'fcgi.inc';
++ /* keep one worker busy with the request so that the other one serves the status page */
++ $client = new Adoy\FastCGI\Client('127.0.0.1', $port);
++ $id = $client->async_request(array(
++ 'GATEWAY_INTERFACE' => 'FastCGI/1.0',
++ 'REQUEST_METHOD' => '<svg>',
++ 'SCRIPT_FILENAME' => $scriptFilename,
++ 'SCRIPT_NAME' => '/ghsa-3mg3-cr28-46gc-<svg>.php',
++ 'REQUEST_URI' => '/ghsa-3mg3-cr28-46gc-<svg>.php',
++ 'HTTP_AUTHORIZATION' => 'Basic ' . base64_encode('"<svg onload=x>:x'),
++ 'SERVER_PROTOCOL' => 'HTTP/1.1',
++ 'REMOTE_ADDR' => '127.0.0.1',
++ 'CONTENT_LENGTH' => 0,
++ ), false);
++ usleep(200000);
++
++ $html = run_request('127.0.0.1', $port, '/status', 'full&html');
++ var_dump(strpos($html, '<svg'));
++ var_dump(substr_count($html, '<svg'));
++
++ $json = run_request('127.0.0.1', $port, '/status', 'full&json');
++ $status = json_decode(substr($json, strpos($json, "\r\n\r\n") + 4), true);
++ foreach ($status['processes'] as $proc) {
++ if ($proc['request method'] === '<svg>') {
++ var_dump($proc['user'], $proc['script'] === $scriptFilename);
++ }
++ }
++ $client->wait_for_response($id, 5000);
++ } catch (Exception $e) {
++ echo "IPv4 error\n";
++ }
++
++ proc_terminate($fpm);
++ stream_get_contents($tail);
++ fclose($tail);
++ proc_close($fpm);
++}
++
++?>
++Done
++--EXPECTF--
++[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d
++[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections
++bool(false)
++int(4)
++string(15) ""<svg onload=x>"
++bool(true)
++Done
++--CLEAN--
++<?php
++ $logfile = dirname(__FILE__).'/php-fpm.log.tmp';
++ @unlink($logfile);
++ @unlink(dirname(__FILE__) . '/ghsa-3mg3-cr28-46gc-<svg>.php');
++?>
diff --git a/php-cve-2026-129481.patch b/php-cve-2026-129481.patch
new file mode 100644
index 0000000..fcce525
--- /dev/null
+++ b/php-cve-2026-129481.patch
@@ -0,0 +1,117 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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: Zero PS(session_started_filename)
+ early
+
+Also do not continue after an interrupted RSHUTDOWN()
+
+Co-authored-by: Jakub Zelenka <bukka at php.net>
+
+Fixes GHSA-g3vh-838c-65v7
+Fixes CVE-2026-129481
+Backport of https://github.com/php/php-src/commit/ad9b44ae611962c8b770ffc962ddff0c30d7d77c
+
+5.6: only the Zend part applies. There is no PS(session_started_filename); the state
+left behind is PS(mod_user_names), which session RSHUTDOWN releases only after it has
+destroyed the session data, so a bailout there makes the next request release them
+again. 5.6 runs all RSHUTDOWN handlers in one zend_try, so the catch covers the loop.
+The upstream FPM test needs the FPM\Tester harness; a CGI -T 2 test is added instead.
+---
+diff --git a/Zend/zend_API.c b/Zend/zend_API.c
+--- a/Zend/zend_API.c
++++ b/Zend/zend_API.c
+@@ -2504,6 +2504,9 @@ ZEND_API void zend_deactivate_modules(TSRMLS_D) /* {{{ */
+ 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
+--- /dev/null
++++ b/sapi/cgi/tests/ghsa-g3vh-838c-65v7.phpt
+@@ -0,0 +1,79 @@
++--TEST--
++GHSA-g3vh-838c-65v7 (no further request after a bailout in session RSHUTDOWN)
++--SKIPIF--
++<?php
++include "skipif.inc";
++if (!extension_loaded("session")) die("skip session extension not loaded");
++?>
++--FILE--
++<?php
++include "include.inc";
++
++$php = get_cgi_path();
++$dir = dirname(__FILE__) . "/ghsa-g3vh-838c-65v7.dir";
++ at mkdir($dir);
++$script = $dir . "/target.php";
++file_put_contents($script, <<<'PHP'
++<?php
++$marker = dirname(__FILE__) . '/producer-done';
++if (file_exists($marker)) {
++ echo "second request\n";
++ return;
++}
++touch($marker);
++class StaleHandler extends SessionHandler {}
++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('bailout in session RSHUTDOWN', E_USER_ERROR); }
++}
++stream_wrapper_register('shutdown-test', 'ShutdownStream');
++session_set_save_handler(new StaleHandler, false);
++session_id('ghsag3vh');
++session_start();
++/* $_SESSION is unset, so the stream is only destroyed with the session data in RSHUTDOWN */
++$_SESSION['stream'] = fopen('shutdown-test://session', 'w');
++unset($_SESSION);
++echo "first request\n";
++PHP
++);
++
++/* -T 2 runs the script twice in one process, like a persistent SAPI; the explicit
++ * environment keeps the CGI from picking up the SCRIPT_FILENAME of this test */
++/* -n drops the ini that loads shared extensions: load the ones this process has, in its order */
++$ext = "";
++foreach (get_loaded_extensions() as $name) {
++ $so = strtolower($name) . ".so";
++ if (file_exists(ini_get("extension_dir") . "/" . $so)) {
++ $ext .= " -d extension=" . $so;
++ }
++}
++if ($ext !== "") {
++ $ext = " -d extension_dir=" . escapeshellarg(ini_get("extension_dir")) . $ext;
++}
++$cmd = escapeshellarg($php) . " -n" . $ext . " -q -d session.save_path=" . escapeshellarg($dir) . " -d session.use_cookies=0 -d session.cache_limiter= -d display_errors=1 -d html_errors=0 -d log_errors=0 -T 2 " . escapeshellarg($script);
++$env = array();
++foreach (array("PATH", "LD_LIBRARY_PATH") as $name) {
++ if (getenv($name) !== false) {
++ $env[$name] = getenv($name);
++ }
++}
++$p = proc_open($cmd, array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("file", "/dev/null", "w")), $pipes, null, $env);
++fclose($pipes[0]);
++echo stream_get_contents($pipes[1]);
++fclose($pipes[1]);
++var_dump(proc_close($p));
++?>
++--CLEAN--
++<?php
++$dir = dirname(__FILE__) . "/ghsa-g3vh-838c-65v7.dir";
++foreach (glob($dir . "/*") as $f) {
++ unlink($f);
++}
++ at rmdir($dir);
++?>
++--EXPECTF--
++first request
++%AFatal error: bailout in session RSHUTDOWN in %starget.php on line %d
++int(1)
diff --git a/php-cve-2026-129496.patch b/php-cve-2026-129496.patch
new file mode 100644
index 0000000..356c488
--- /dev/null
+++ b/php-cve-2026-129496.patch
@@ -0,0 +1,31 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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
+
+Fixes GHSA-gr4f-wgx5-jpfv
+Fixes CVE-2026-129496
+Backport of https://github.com/php/php-src/commit/f986c5ca37c0fdc50595d8291a9920a1df23bf38
+
+5.6: no zend_test extension, so the upstream test (zend_test.warn_on_startup) is not ported.
+---
+diff --git a/main/main.c b/main/main.c
+--- a/main/main.c
++++ b/main/main.c
+@@ -715,15 +715,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
+ char *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 TSRMLS_CC);
+- } else {
+- error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC);
+- }
+-#else
+- error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC);
+-#endif
++ error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, PG(modules_activated) && EG(active) TSRMLS_CC);
+ len = spprintf(&tmp, 0, "[%s] %s%s", 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..47da239
--- /dev/null
+++ b/php-cve-2026-129506.patch
@@ -0,0 +1,123 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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
+
+Fixes GHSA-4646-p932-gw34
+Fixes CVE-2026-129506
+Backport of https://github.com/php/php-src/commit/66db5cda7df3d7a0e1fc7b171bd9ca318fca49fb
+
+PLD: GHSA-4646-p932-gw34-wsdl.phpt covers the WSDL loader, which reads entity-valued
+attributes after the parse as well.
+---
+diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
+--- 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-wsdl.phpt b/ext/soap/tests/GHSA-4646-p932-gw34-wsdl.phpt
+new file mode 100644
+--- /dev/null
++++ b/ext/soap/tests/GHSA-4646-p932-gw34-wsdl.phpt
+@@ -0,0 +1,53 @@
++--TEST--
++GHSA-4646-p932-gw34: WSDL attribute entity references must not outlive their DTD
++--SKIPIF--
++<?php require_once('skipif.inc'); ?>
++--INI--
++soap.wsdl_cache_enabled=0
++--FILE--
++<?php
++$wsdl = dirname(__FILE__) . '/GHSA-4646-p932-gw34-wsdl.wsdl';
++file_put_contents($wsdl, <<<'XML'
++<?xml version="1.0" encoding="UTF-8"?>
++<!DOCTYPE definitions [<!ENTITY e "entityOperationName">]>
++<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
++ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
++ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
++ xmlns:tns="urn:dtd"
++ targetNamespace="urn:dtd">
++ <message name="emptyRequest"/>
++ <message name="stringResponse"><part name="result" type="xsd:string"/></message>
++ <portType name="DtdPortType">
++ <operation name="&e;">
++ <input message="tns:emptyRequest"/>
++ <output message="tns:stringResponse"/>
++ </operation>
++ </portType>
++ <binding name="DtdBinding" type="tns:DtdPortType">
++ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
++ <operation name="&e;">
++ <soap:operation soapAction="&e;"/>
++ <input><soap:body use="encoded" namespace="urn:dtd" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
++ <output><soap:body use="encoded" namespace="urn:dtd" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
++ </operation>
++ </binding>
++ <service name="DtdService">
++ <port name="DtdPort" binding="tns:DtdBinding">
++ <soap:address location="test://"/>
++ </port>
++ </service>
++</definitions>
++XML
++);
++$client = new SoapClient($wsdl);
++var_dump($client->__getFunctions());
++?>
++--CLEAN--
++<?php
++ at unlink(dirname(__FILE__) . '/GHSA-4646-p932-gw34-wsdl.wsdl');
++?>
++--EXPECT--
++array(1) {
++ [0]=>
++ string(28) "string entityOperationName()"
++}
+diff --git a/ext/soap/tests/GHSA-4646-p932-gw34.phpt b/ext/soap/tests/GHSA-4646-p932-gw34.phpt
+new file mode 100644
+--- /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
++--SKIPIF--
++<?php require_once('skipif.inc'); ?>
++--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, array(
++ '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..8f79435
--- /dev/null
+++ b/php-cve-2026-129538.patch
@@ -0,0 +1,95 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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.
+
+Fixes GHSA-5j3f-64r7-f564
+Fixes CVE-2026-129538
+Backport of https://github.com/php/php-src/commit/964cdcfa5adfa577cde97df89fc8fda04815694d
+---
+diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
+--- a/sapi/cgi/cgi_main.c
++++ b/sapi/cgi/cgi_main.c
+@@ -1268,9 +1268,9 @@ static void init_request_info(fcgi_request *request TSRMLS_DC)
+ */
+ int slen = len - strlen(pt);
+ int 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
+--- /dev/null
++++ b/sapi/cgi/tests/ghsa-5j3f-64r7-f564.phpt
+@@ -0,0 +1,59 @@
++--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 = dirname(__FILE__) . "/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, $env) {
++ $base_env = array();
++ if (getenv("PATH") !== false) {
++ $base_env["PATH"] = getenv("PATH");
++ }
++ $p = proc_open(
++ escapeshellarg($php) . " -n -d cgi.fix_pathinfo=1",
++ array(0 => array("pipe", "r"), 1 => array("pipe", "w")),
++ $pipes,
++ null,
++ $env + array("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, array("SCRIPT_FILENAME" => "$script/b", "PATH_INFO" => "/a/b"));
++
++echo "Suffix longer than PATH_INFO\n";
++run_cgi($php, array("SCRIPT_FILENAME" => "$script/xxxxxxxxxxxxxxxx", "PATH_INFO" => "/x"));
++
++echo "Suffix taken from PATH_TRANSLATED\n";
++run_cgi($php, array(
++ "SCRIPT_FILENAME" => $php,
++ "PATH_TRANSLATED" => "$script/xxxxxxxxxxxxxxxx",
++ "REDIRECT_URL" => "/redirected",
++ "PATH_INFO" => "/x",
++));
++?>
++--CLEAN--
++<?php
++ at unlink(dirname(__FILE__) . "/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..be89282
--- /dev/null
+++ b/php-cve-2026-15353.patch
@@ -0,0 +1,268 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+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
+
+Fixes GHSA-q23r-hr55-xmpg
+Fixes CVE-2026-15353
+Backport of https://github.com/php/php-src/commit/59e46404a744b7ef469f51acd3ee225d518dbaf8
+
+5.6: tests without PHP 7/8 syntax and without ext/json.
+---
+diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
+--- a/ext/soap/php_encoding.c
++++ b/ext/soap/php_encoding.c
+@@ -2139,7 +2139,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
+--- /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 require_once('skipif.inc'); ?>
++--INI--
++soap.wsdl_cache_enabled=0
++--FILE--
++<?php
++
++define('WSDL', dirname(__FILE__) . '/GHSA-q23r-hr55-xmpg-wsdl.wsdl');
++
++function itemType() { return array('A', 'B', 'C'); }
++function sizeOnly() { return array('A', 'B', 'C'); }
++
++function request($operation) {
++ 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($arrayType) {
++ $this->arrayType = $arrayType;
++ parent::__construct(WSDL);
++ }
++
++ public function __doRequest($request, $location, $action, $version, $oneWay = 0) {
++ 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(array('itemType', 'sizeOnly'));
++
++foreach (array('itemType', 'sizeOnly') as $operation) {
++ ob_start();
++ $server->handle(request($operation));
++ $response = ob_get_clean();
++
++ echo 'encode ', $operation, ' => ', preg_match('/arraySize="[^"]*"/', $response, $matches) ? $matches[0] : 'none', "\n";
++}
++
++foreach (array('ItemType', 'SizeOnly') as $arrayType) {
++ $client = new ReplayClient($arrayType);
++ $out = array();
++ foreach ($client->{lcfirst($arrayType)}() as $k => $v) {
++ $out[] = "$k=$v";
++ }
++ echo 'decode ', $arrayType, ' => ', implode(',', $out), "\n";
++}
++
++?>
++--EXPECT--
++encode itemType => arraySize="3"
++encode sizeOnly => arraySize="3"
++decode ItemType => 0=A,1=B,2=C
++decode SizeOnly => 0=A,1=B,2=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
+--- /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
+--- /dev/null
++++ b/ext/soap/tests/GHSA-q23r-hr55-xmpg.phpt
+@@ -0,0 +1,76 @@
++--TEST--
++GHSA-q23r-hr55-xmpg: Out-of-bounds read on empty SOAP-ENC:arraySize
++--SKIPIF--
++<?php require_once('skipif.inc'); ?>
++--FILE--
++<?php
++
++function echo_back($data) { $GLOBALS['decoded'][] = $data; return null; }
++
++function request($arraySize, $itemType = '') {
++ $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 dump($v) {
++ if (is_array($v)) {
++ $out = array();
++ foreach ($v as $k => $e) {
++ $out[] = var_export($k, true) . '=>' . dump($e);
++ }
++ return '[' . implode(',', $out) . ']';
++ }
++ return var_export($v, true);
++}
++
++function decode($server, $request) {
++ ob_start();
++ $server->handle($request);
++ $response = ob_get_clean();
++
++ if (strpos($response, '<SOAP-ENV:Fault>') !== false) {
++ return 'fault: ' . strip_tags($response);
++ }
++
++ return dump(array_pop($GLOBALS['decoded']));
++}
++
++$server = new SoapServer(null, array('uri' => 'http://test'));
++$server->addFunction('echo_back');
++
++$GLOBALS['decoded'] = array();
++
++foreach (array('', ' ', '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--
++'' => [0=>'A',1=>'B',2=>'C']
++' ' => [0=>'A',1=>'B',2=>'C']
++'abc' => [0=>'A',1=>'B',2=>'C']
++'*' => [0=>'A',1=>'B',2=>'C']
++'3' => [0=>'A',1=>'B',2=>'C']
++'2 2' => [0=>[0=>'A',1=>'B'],1=>[0=>'C']]
++itemType => [0=>'A',1=>'B',2=>'C']
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/php.git/commitdiff/53fed44df03f088f6a4979038c1ee45d90afb634
More information about the pld-cvs-commit
mailing list