Repository navigation
Property get/set implementation - #32
Conversation
There was a problem hiding this comment.
This is wrong. This will try to read more data from a than allocated. Use emalloc+ 2xmemcpyorsuch ...
|
I've added a few quick notes on some small code issues, without doing a proper review. Please mind: Discussion about such a big feature should happen on internals, not here, so everybody is involved. |
|
It was recommended that I do a pull request by Alexey Shein... getting mixed signals on appropriate procedure... |
|
A pull request is nice for people to test it out and lateron (maybe) merge it. It's ok to discuss the actual implementation. For discussions about the concept/design it is bad, as not everybody is watching these and it's hard to follow (missing threading etc.) |
|
Alright... so not sure which way to go here. I've attempted to start discussion on the implementation several times over the last few months with little response. The original RFC was written two years ago and I was told by that author that it was vetted pretty heavily. With rare exception I've followed that RFC closely. So after I address these issues, should I cancel this pull request and re-submit or do something else? |
|
I guess I see that the new commits automagically end up here. Let me know how you want me to proceed. AFAIK everything you mentioned here has been addressed. |
|
There are a tonne of whitespace changes in this PR, should they be there? |
|
Unless something converted them incorrectly, yeah they should be there. Do you have a specific section you're concerned about?
|
There was a problem hiding this comment.
that ';' on line 50 is obviously a typo
There was a problem hiding this comment.
Good catch, I wonder how it even compiles
-----Original Message-----
From: Anatoliy Belsky [mailto:reply@reply.github.com]
Sent: Wednesday, July 04, 2012 9:43 AM
To: Clint Priest
Subject: Re: [php-src] Property get/set implementation (#32)@@ -34,6 +34,23 @@
#define FREE_PNODE(znode) zval_dtor(&znode->u.constant);
+#define IS_ACCESSOR(purpose) ( purpose >= ZEND_FNP_PROP_GETTER && purpose <= ZEND_FNP_PROP_UNSETTER )
+
+#define MAKE_ZNODE(zn, str) \
- { \
zn.op_type = IS_CONST; \INIT_PZVAL(&zn.u.constant); \ZVAL_STRINGL(&zn.u.constant, str, strlen(str), 1); \zn.EA = 0; \- }
+#define MAKE_ZNODEL(zn, str, l) \- { \
zn.op_type = IS_CONST; \INIT_PZVAL(&zn.u.constant); \ZVAL_STRINGL(&zn.u.constant, str, l;, 1); \that ';' on line 50 is obviously a typo
Reply to this email directly or view it on GitHub:
https://github.com/php/php-src/pull/32/files#r1100500
There was a problem hiding this comment.
That's simple ... macro expansion. This becomes
/* ... _/
const char *__s=(str); int __l=l;;
zval *_z = (&zn.u.constant);
/ ... */
before the compiler even sees it ... and the extra ; is valid.
Macros are evil (but we'd need C++ templates as feasible alternative, but we're doing C ...)
|
There is another place where it'll be unhappy in that macros I think, Z_STRVAL_P(z) = (duplicate?estrndup(__s, ____l;):(char*)__s);\ |
There was a problem hiding this comment.
One more place where declaration should go upper )
There was a problem hiding this comment.
What do you mean by go upper? What line are you referring to?
There was a problem hiding this comment.
Line 1705 ==> znode unused_node, unused_node2, value_node;
This should go up to the line 1693 at least. When it's synced with master, I'll test it today )
There was a problem hiding this comment.
C89 says in §3.6.2
compound-statement:
{ declaration-list<opt> statement-list<opt> }
Or in other words: In a code block enclosed by { } variable declarations go first, then statments. So this is valid:
{ int a; foo(); }
whereas
{ foo(); int a; }
is invalid. This is different in C++ and C99.
There was a problem hiding this comment.
Ah right, you mentioned this before and I fixed a bunch of these. Not sure if I missed this or forgot again, my apologies. My fork is synced with master as of this morning, but isset/unset accessors are not completely working right. What is checked in is a partial implementation of the isset/unset accessors but there are some contexts it won't work in, everything else should be 100% unless something merged in from master broke something I've done.
I'm hoping to be able to spend an hour or so a day again on this project to get it completed, been working on it almost a year now. :)
There was a problem hiding this comment.
Hi,
did you push that sync because I can't see any commits about that ) .. or do I miss something?
There was a problem hiding this comment.
Hmm, well I thought it had. I had checked against a recent commit from the main repo against what the fork on github showed and I saw the same changes but I just checked another change and I'm not seeing them now. I'll poke around some more and see what's up. Not super familiar with git just yet.
There was a problem hiding this comment.
Alright, showing merge/commit now on my github fork, also took care of the variable declaration moving to beginning of block (unused node).
|
May be you could merge the current master into your branch? As there are a couple of rejected files because master seems to have some stuff from this patch already. I could test it then. |
|
Alright, it's caught back up with master. I'll work on these comments this morning. The isset/unset accessors functionality is mostly completed but I need to see where I left off and finish that up. |
|
I've run the compilation on windows, it's broken, here are the compiler messages Zend/zend_language_scanner.c(5741) : error C2045: 'yy571' : label redefined and so on about 20 lines. Not sure if only the first line counts. Also, I din't try on linux, but it's probably the same there. Ah, this happens either when I pull from your repo into my working tree or when I clone your repo, so the same on both. Another thing is I've discovered - as github says in it's docs, one get get just a patch using an URL like https://github.com/php/php-src/pull/32.patch ... but when I look at it, it's too old. github has bugs too :) EDIT: indeed, when i look into Zend/zend_language_scanner.c , the warned labels are defined twice. |
|
Do you have the re2c available? Sounds like the zend_language_scanner.c file needs to be recompiled... I ran into this when I first started on this project...
|
|
I've just cloned your branch on linux and did a fresh compile, aka "./buildconf && ./configure && make" ... and I see the same Zend/zend_language_scanner.c: In function ‘lex_scan’: As your branch is synced with master now, the same were after the pull request were merged. On win re2c is of course available with the php-sdk. Could you give me an advise how to regenerate the scanner code? I'll try then to compile on linux and windows again. |
|
Got it, but that's strange. Just took the corresponding line from the Makefile and ran it manually re2c --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l so will test further ) |
|
Glad it was resolved. At the time I ran into a similar problem I was told to just delete the zend_language_scanner.c file and it would be regenerated... LMK how the testing goes and thank you! I have written numerous test cases: tests/classes/accessor_final_inner_error.phpt There are also some test cases for the php/reflection extension.
|
|
The first run is actually very good - no test fails on linux and windows )) Despite that, when run with valgrind on linux, all tests are shown as leaked. But it's almost the same line. I've uploaded some valgrind traces, you'll find that under http://belsky.info/phpz/cpriest/ |
|
Thanks for the traces. Can you tell me the command line you used to produce these so I can test to be sure they are resolved on my end? This could be due to the currently "mixed state," Some of the committed code includes changes to allow isset/unset accessor and not all use cases are covered yet. I am in the middle of a slight re-write of the auto-implementation code which could be where this has come from.
|
|
Actually the param -m is responsible for the memory checks To run a particular test do To debug it, you could do first Let me know when I can test it again :) |
|
I've been working pretty heavily on this again, nearly complete. There have been some major changes. I've also been reading the pro git book. It's been suggested that I rebase the code and I was thinking of "starting over" with a fresh fork, creating a branch and applying my commits as a rebase on that branch, push back up here and go from there. What would you suggest? Would that mean killing this pull request and starting a new one? Would these comments be gone? |
|
Alright, was getting back to the -m tests. If I run all of my tests through run-tests.php using the -m option, they all "PASS". I've seen valgrind output before and I don't speak it, I haven't seen any output from the latest -m run-through, does this mean all of my tests pass "valgrind" as well or is there some other output I should be looking for to see that valgrind is happy? Only things remaining on this are to update reflection and add a couple of requested functions. Then I believe this very large patch is feature-complete, unless the latest round of RFC comes up with yet more requests. |
… ours backport-php2shell.patch becomes two patches: - backport-php2shell-1.patch: the code of remicollet/php-src-security pull request #32 (RalphJS, 477c04a64), the same port of "Avoid state corruption via bailout" to PHP 5.6 as ours, as it is. When Remi Collet merges it, the sync finds it upstream (patch -R --dry-run) and skips it, instead of failing on a patch that no longer applies. - backport-php2shell-2-extra.patch: what the official fix and Ondrej Sury's port have and that pull request has not, on top of it: the smallest arrays for $_GET, $_POST, $_COOKIE and their sub-arrays, the reset of EG(error_handling) and EG(exception) right after the object store is freed, EG(exception_class), SG(callback_func), and _exit() for "Out of memory" of the persistent allocator wrappers. The resulting code is that of the old patch, apart from comments and the place of a few resets, and isspace((unsigned char)...) in rfc1867.c as in the official fix. Checked: on freebsd/5.6 with the old patch reverted the two apply and give that; on PR #32 merged the first is skipped and the second applies to the same files; 5.6 builds, memory_limit ends the worker with "Allowed memory size" and exit 1; Zend/tests, tests/, ext/session/tests and ext/standard/tests/strings: 3308 passed, 10 failed (bug45392 and 8 session rfc1867 tests, as with the old patch and in the pull request, bug70748 before). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012MTu7o5YbEEt9X1bezhrq3
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()) - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (131fde8), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (131fde8): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()) - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (131fde8), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (131fde8): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()) - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (131fde8), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (131fde8): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()) - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (131fde8), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (131fde8): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()) - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (131fde8), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (131fde8): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()) - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (131fde8), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (131fde8): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()) - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (131fde8), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (131fde8): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6
… ours backport-php2shell.patch becomes two patches: - backport-php2shell-1.patch: the code of remicollet/php-src-security pull request #32 (RalphJS, 477c04a64), the same port of "Avoid state corruption via bailout" to PHP 5.6 as ours, as it is. When Remi Collet merges it, the sync finds it upstream (patch -R --dry-run) and skips it, instead of failing on a patch that no longer applies. - backport-php2shell-2-extra.patch: what the official fix and Ondrej Sury's port have and that pull request has not, on top of it: the smallest arrays for $_GET, $_POST, $_COOKIE and their sub-arrays, the reset of EG(error_handling) and EG(exception) right after the object store is freed, EG(exception_class), SG(callback_func), and _exit() for "Out of memory" of the persistent allocator wrappers. The resulting code is that of the old patch, apart from comments and the place of a few resets, and isspace((unsigned char)...) in rfc1867.c as in the official fix. Checked: on freebsd/5.6 with the old patch reverted the two apply and give that; on PR #32 merged the first is skipped and the second applies to the same files; 5.6 builds, memory_limit ends the worker with "Allowed memory size" and exit 1; Zend/tests, tests/, ext/session/tests and ext/standard/tests/strings: 3308 passed, 10 failed (bug45392 and 8 session rfc1867 tests, as with the old patch and in the pull request, bug70748 before). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()) - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (5d7c52e), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (5d7c52e): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()); the test DatePeriod_uninitialized_interval.phpt of php-src commit 575c10c (25.10.2026, Jamal Tantaoui, the same fix in 7.4), with date.timezone for 5.6 - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-getimagesize.patch: GHSA-3237-qqm7-mfv7 (CVE-2025-14177): getimagesize() reads an APPn segment of a JPEG from a stream in chunks until it has the whole segment, instead of handing back in $imageinfo a buffer that a short read left partly uninitialized (a leak of process memory). Origin: php-src commit 6cf0fb3 (phpGH-20584, 25.11.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test - backport-hostname-nul.patch: GHSA-3cr5-j632-f35r (CVE-2025-1220): a host name with a NUL byte is refused by the socket transports (fsockopen(), stream_socket_client(), the http:// and ftp:// wrappers) with "The hostname must not contain null bytes", instead of being cut at the NUL, so that a check of the whole name and the connection no longer disagree; fsockopen() builds host:port with the length of the host name. Origin: php-src commit d407d8a (10.04.2025, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-http-response-headers.patch: GHSA-v8xr-gpvj-cx9g (CVE-2025-1217), GHSA-pcmh-g36c-qc44 (CVE-2025-1734), GHSA-52jp-hrpf-2jff (CVE-2025-1861) and GHSA-hgf5-96fm-v528 (CVE-2025-1736) for PHP 5.6: the http:// stream wrapper reads the response headers as PHP 7.4 and later do: a folded header (a line that starts with a space or a tab) is joined to the header before it, a header line without a colon, with a space in the header name, starting with a CR or folded before the first header fails the request, a Location header is followed with up to 8182 bytes (5.6 cut it at 1024 bytes) and fails the request when longer, and an Authorization or Proxy-Authorization header of the user is seen only at the start of a header line, so that the one made from the user:password of the URL is no longer left out when the name appears inside another header; with the bounds fixes of phpGH-23467 (CVE-2026-93682) and phpGH-23521 for a relative Location. An empty Location header is not followed, as before in 5.6 (7.4 and later go to /). Origin: port of php-src commits bf4a8df (31.12.2024), 0b965cf (19.01.2025), 134f821 (14.02.2025) and 5418040 (04.03.2025, all Jakub Zelenka), f489702 (24.08.2026, Ilia Alshanetsky) and bd7e19b (31.08.2026, Jordi Kroon) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with their tests and bug47021.phpt and bug75535.phpt of that branch (5.6 had neither), and ext/standard/tests/http/ServerClientTestCase.inc of that branch without the type declarations PHP 5 does not have; the ghsa-hgf5 tests read the request up to its empty line, as 5.6 sends it in several writes; http_empty_location_no_redirect.phpt is ours - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-network-nul.patch: GHSA-www2-q4fc-65wf: checkdnsrr(), dns_check_record(), dns_get_record(), dns_get_mx(), getmxrr(), inet_pton(), ip2long(), getservbyname(), getservbyport() and getprotobyname() refuse an argument with a NUL byte (a warning and NULL, as a path with one) instead of using the part before it; their warning for an argument of the wrong type says "a valid path" instead of "string", as in 7.4. Origin: php-src commit 3e9d47f (06.09.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the variation tests of 5.6 (7.4 has none of them) expect the new warning - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-pgsql-unchecked-escape.patch: GHSA-hrwm-9436-5mv3 (CVE-2025-1735): pgsql and pdo_pgsql check the errors of PQescapeStringConn(), PQescapeByteaConn() and PQescapeIdentifier(): a string that is not valid in the client encoding makes pg_escape_string() throw an exception, pg_insert(), pg_update(), pg_delete(), pg_select() and pg_convert() fail with a notice and PDO::quote() return false, instead of a value escaped only in part going into the query. Origin: port of php-src commit df2ecf3 (04.03.2025, Jakub Zelenka) and of its fix 68c07d5 (25.10.2026: free the escaped string when escaping fails) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests and the test of GHSA-8xr5-qppj-gvwj (cfa5b78, a PDO quote that fails with emulated prepares) - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (5d7c52e), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (5d7c52e): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap-qname.patch: GHSA-453j-q27h-5p8x (CVE-2025-6491): serialize_zval() of ext/soap checks for a NULL node and a NULL node name before comparing the name with "BOGUS". libxml2 before 2.13 leaves the name NULL when it is longer than 2 GB; PHP 5 strings cannot be that long, and the upstream test needs one, so it is not carried. Origin: php-src commit c13a3b2 (03.06.2025, Ahmed Lekssays) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-soap-ref-map.patch: GHSA-85c2-q967-79q5 (CVE-2026-6722): while SoapServer and SoapClient decode a message, the map of the objects that an href can point to holds a reference to each of them, so that an object freed while decoding (an apache:Map item replaced by a later item with the same key) is no longer used by a later href (use after free). PHP 5 counts references on the zval itself, so the result of a SoapClient call is taken over without freeing a zval that the map still holds; an object reached through an href is no longer a PHP reference (var_dump() shows no &), as in PHP 7. Origin: port of php-src commit 6c4b67c (03.05.2026, Ilija Tovilo) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the SoapClient test is ours - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6 - backport-unsigned-char-ctype.patch: GHSA-m8rr-4c36-8gq4 (CVE-2026-7258): every char handed to a ctype.h function (isalpha(), isdigit(), isspace(), tolower(), toupper() and the others) is cast to unsigned char: a byte of 0x80 and above made a negative argument, which the C standard leaves undefined and some C libraries use as an index before their table (FreeBSD and glibc check or allow it). The places of 7.4 that 5.6 does not have are left out. Origin: port of php-src commits b44c4c8 (03.05.2026, Ilija Tovilo) and 2c4b0c4 (25.10.2026: the -d value check of the CLI, CGI, FPM and phpdbg SAPIs) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports); in 5.6 also in ext/gd/libgd/xbm.c (gd_xbm.c in 7.4) and in the files that re2c made from the changed .re files - backport-xml-toffset-test.patch: GHSA-wg4p-4hqh-c3g9 (a recurrence of bug #72714 in xml_parse_into_struct() with XML_OPTION_SKIP_TAGSTART): the test only; 5.6 is not affected, as it passes the tag name to _xml_add_to_info() through SKIP_TAGSTART(), which bounds the offset. Origin: the test of php-src commit c5e836c (18.12.2024, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports)
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()); the test DatePeriod_uninitialized_interval.phpt of php-src commit 575c10c (25.10.2026, Jamal Tantaoui, the same fix in 7.4), with date.timezone for 5.6 - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-getimagesize.patch: GHSA-3237-qqm7-mfv7 (CVE-2025-14177): getimagesize() reads an APPn segment of a JPEG from a stream in chunks until it has the whole segment, instead of handing back in $imageinfo a buffer that a short read left partly uninitialized (a leak of process memory). Origin: php-src commit 6cf0fb3 (phpGH-20584, 25.11.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test - backport-hostname-nul.patch: GHSA-3cr5-j632-f35r (CVE-2025-1220): a host name with a NUL byte is refused by the socket transports (fsockopen(), stream_socket_client(), the http:// and ftp:// wrappers) with "The hostname must not contain null bytes", instead of being cut at the NUL, so that a check of the whole name and the connection no longer disagree; fsockopen() builds host:port with the length of the host name. Origin: php-src commit d407d8a (10.04.2025, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-http-response-headers.patch: GHSA-v8xr-gpvj-cx9g (CVE-2025-1217), GHSA-pcmh-g36c-qc44 (CVE-2025-1734), GHSA-52jp-hrpf-2jff (CVE-2025-1861) and GHSA-hgf5-96fm-v528 (CVE-2025-1736) for PHP 5.6: the http:// stream wrapper reads the response headers as PHP 7.4 and later do: a folded header (a line that starts with a space or a tab) is joined to the header before it, a header line without a colon, with a space in the header name, starting with a CR or folded before the first header fails the request, a Location header is followed with up to 8182 bytes (5.6 cut it at 1024 bytes) and fails the request when longer, and an Authorization or Proxy-Authorization header of the user is seen only at the start of a header line, so that the one made from the user:password of the URL is no longer left out when the name appears inside another header; with the bounds fixes of phpGH-23467 (CVE-2026-93682) and phpGH-23521 for a relative Location. An empty Location header is not followed, as before in 5.6 (7.4 and later go to /). Origin: port of php-src commits bf4a8df (31.12.2024), 0b965cf (19.01.2025), 134f821 (14.02.2025) and 5418040 (04.03.2025, all Jakub Zelenka), f489702 (24.08.2026, Ilia Alshanetsky) and bd7e19b (31.08.2026, Jordi Kroon) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with their tests and bug47021.phpt and bug75535.phpt of that branch (5.6 had neither), and ext/standard/tests/http/ServerClientTestCase.inc of that branch without the type declarations PHP 5 does not have; the ghsa-hgf5 tests read the request up to its empty line, as 5.6 sends it in several writes; http_empty_location_no_redirect.phpt is ours - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-network-nul.patch: GHSA-www2-q4fc-65wf: checkdnsrr(), dns_check_record(), dns_get_record(), dns_get_mx(), getmxrr(), inet_pton(), ip2long(), getservbyname(), getservbyport() and getprotobyname() refuse an argument with a NUL byte (a warning and NULL, as a path with one) instead of using the part before it; their warning for an argument of the wrong type says "a valid path" instead of "string", as in 7.4. Origin: php-src commit 3e9d47f (06.09.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the variation tests of 5.6 (7.4 has none of them) expect the new warning - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-pgsql-unchecked-escape.patch: GHSA-hrwm-9436-5mv3 (CVE-2025-1735): pgsql and pdo_pgsql check the errors of PQescapeStringConn(), PQescapeByteaConn() and PQescapeIdentifier(): a string that is not valid in the client encoding makes pg_escape_string() throw an exception, pg_insert(), pg_update(), pg_delete(), pg_select() and pg_convert() fail with a notice and PDO::quote() return false, instead of a value escaped only in part going into the query. Origin: port of php-src commit df2ecf3 (04.03.2025, Jakub Zelenka) and of its fix 68c07d5 (25.10.2026: free the escaped string when escaping fails) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests and the test of GHSA-8xr5-qppj-gvwj (cfa5b78, a PDO quote that fails with emulated prepares) - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (5d7c52e), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (5d7c52e): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap-qname.patch: GHSA-453j-q27h-5p8x (CVE-2025-6491): serialize_zval() of ext/soap checks for a NULL node and a NULL node name before comparing the name with "BOGUS". libxml2 before 2.13 leaves the name NULL when it is longer than 2 GB; PHP 5 strings cannot be that long, and the upstream test needs one, so it is not carried. Origin: php-src commit c13a3b2 (03.06.2025, Ahmed Lekssays) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-soap-ref-map.patch: GHSA-85c2-q967-79q5 (CVE-2026-6722): while SoapServer and SoapClient decode a message, the map of the objects that an href can point to holds a reference to each of them, so that an object freed while decoding (an apache:Map item replaced by a later item with the same key) is no longer used by a later href (use after free). PHP 5 counts references on the zval itself, so the result of a SoapClient call is taken over without freeing a zval that the map still holds; an object reached through an href is no longer a PHP reference (var_dump() shows no &), as in PHP 7. Origin: port of php-src commit 6c4b67c (03.05.2026, Ilija Tovilo) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the SoapClient test is ours - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6 - backport-unsigned-char-ctype.patch: GHSA-m8rr-4c36-8gq4 (CVE-2026-7258): every char handed to a ctype.h function (isalpha(), isdigit(), isspace(), tolower(), toupper() and the others) is cast to unsigned char: a byte of 0x80 and above made a negative argument, which the C standard leaves undefined and some C libraries use as an index before their table (FreeBSD and glibc check or allow it). The places of 7.4 that 5.6 does not have are left out. Origin: port of php-src commits b44c4c8 (03.05.2026, Ilija Tovilo) and 2c4b0c4 (25.10.2026: the -d value check of the CLI, CGI, FPM and phpdbg SAPIs) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports); in 5.6 also in ext/gd/libgd/xbm.c (gd_xbm.c in 7.4) and in the files that re2c made from the changed .re files - backport-xml-toffset-test.patch: GHSA-wg4p-4hqh-c3g9 (a recurrence of bug #72714 in xml_parse_into_struct() with XML_OPTION_SKIP_TAGSTART): the test only; 5.6 is not affected, as it passes the tag name to _xml_add_to_info() through SKIP_TAGSTART(), which bounds the offset. Origin: the test of php-src commit c5e836c (18.12.2024, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports)
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()); the test DatePeriod_uninitialized_interval.phpt of php-src commit 575c10c (25.10.2026, Jamal Tantaoui, the same fix in 7.4), with date.timezone for 5.6 - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-getimagesize.patch: GHSA-3237-qqm7-mfv7 (CVE-2025-14177): getimagesize() reads an APPn segment of a JPEG from a stream in chunks until it has the whole segment, instead of handing back in $imageinfo a buffer that a short read left partly uninitialized (a leak of process memory). Origin: php-src commit 6cf0fb3 (phpGH-20584, 25.11.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test - backport-hostname-nul.patch: GHSA-3cr5-j632-f35r (CVE-2025-1220): a host name with a NUL byte is refused by the socket transports (fsockopen(), stream_socket_client(), the http:// and ftp:// wrappers) with "The hostname must not contain null bytes", instead of being cut at the NUL, so that a check of the whole name and the connection no longer disagree; fsockopen() builds host:port with the length of the host name. Origin: php-src commit d407d8a (10.04.2025, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-http-response-headers.patch: GHSA-v8xr-gpvj-cx9g (CVE-2025-1217), GHSA-pcmh-g36c-qc44 (CVE-2025-1734), GHSA-52jp-hrpf-2jff (CVE-2025-1861) and GHSA-hgf5-96fm-v528 (CVE-2025-1736) for PHP 5.6: the http:// stream wrapper reads the response headers as PHP 7.4 and later do: a folded header (a line that starts with a space or a tab) is joined to the header before it, a header line without a colon, with a space in the header name, starting with a CR or folded before the first header fails the request, a Location header is followed with up to 8182 bytes (5.6 cut it at 1024 bytes) and fails the request when longer, and an Authorization or Proxy-Authorization header of the user is seen only at the start of a header line, so that the one made from the user:password of the URL is no longer left out when the name appears inside another header; with the bounds fixes of phpGH-23467 (CVE-2026-93682) and phpGH-23521 for a relative Location. An empty Location header is not followed, as before in 5.6 (7.4 and later go to /). Origin: port of php-src commits bf4a8df (31.12.2024), 0b965cf (19.01.2025), 134f821 (14.02.2025) and 5418040 (04.03.2025, all Jakub Zelenka), f489702 (24.08.2026, Ilia Alshanetsky) and bd7e19b (31.08.2026, Jordi Kroon) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with their tests and bug47021.phpt and bug75535.phpt of that branch (5.6 had neither), and ext/standard/tests/http/ServerClientTestCase.inc of that branch without the type declarations PHP 5 does not have; the ghsa-hgf5 tests read the request up to its empty line, as 5.6 sends it in several writes; http_empty_location_no_redirect.phpt is ours - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-network-nul.patch: GHSA-www2-q4fc-65wf: checkdnsrr(), dns_check_record(), dns_get_record(), dns_get_mx(), getmxrr(), inet_pton(), ip2long(), getservbyname(), getservbyport() and getprotobyname() refuse an argument with a NUL byte (a warning and NULL, as a path with one) instead of using the part before it; their warning for an argument of the wrong type says "a valid path" instead of "string", as in 7.4. Origin: php-src commit 3e9d47f (06.09.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the variation tests of 5.6 (7.4 has none of them) expect the new warning - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-pgsql-unchecked-escape.patch: GHSA-hrwm-9436-5mv3 (CVE-2025-1735): pgsql and pdo_pgsql check the errors of PQescapeStringConn(), PQescapeByteaConn() and PQescapeIdentifier(): a string that is not valid in the client encoding makes pg_escape_string() throw an exception, pg_insert(), pg_update(), pg_delete(), pg_select() and pg_convert() fail with a notice and PDO::quote() return false, instead of a value escaped only in part going into the query. Origin: port of php-src commit df2ecf3 (04.03.2025, Jakub Zelenka) and of its fix 68c07d5 (25.10.2026: free the escaped string when escaping fails) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests and the test of GHSA-8xr5-qppj-gvwj (cfa5b78, a PDO quote that fails with emulated prepares) - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (5d7c52e), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (5d7c52e): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap-qname.patch: GHSA-453j-q27h-5p8x (CVE-2025-6491): serialize_zval() of ext/soap checks for a NULL node and a NULL node name before comparing the name with "BOGUS". libxml2 before 2.13 leaves the name NULL when it is longer than 2 GB; PHP 5 strings cannot be that long, and the upstream test needs one, so it is not carried. Origin: php-src commit c13a3b2 (03.06.2025, Ahmed Lekssays) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-soap-ref-map.patch: GHSA-85c2-q967-79q5 (CVE-2026-6722): while SoapServer and SoapClient decode a message, the map of the objects that an href can point to holds a reference to each of them, so that an object freed while decoding (an apache:Map item replaced by a later item with the same key) is no longer used by a later href (use after free). PHP 5 counts references on the zval itself, so the result of a SoapClient call is taken over without freeing a zval that the map still holds; an object reached through an href is no longer a PHP reference (var_dump() shows no &), as in PHP 7. Origin: port of php-src commit 6c4b67c (03.05.2026, Ilija Tovilo) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the SoapClient test is ours - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6 - backport-unsigned-char-ctype.patch: GHSA-m8rr-4c36-8gq4 (CVE-2026-7258): every char handed to a ctype.h function (isalpha(), isdigit(), isspace(), tolower(), toupper() and the others) is cast to unsigned char: a byte of 0x80 and above made a negative argument, which the C standard leaves undefined and some C libraries use as an index before their table (FreeBSD and glibc check or allow it). The places of 7.4 that 5.6 does not have are left out. Origin: port of php-src commits b44c4c8 (03.05.2026, Ilija Tovilo) and 2c4b0c4 (25.10.2026: the -d value check of the CLI, CGI, FPM and phpdbg SAPIs) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports); in 5.6 also in ext/gd/libgd/xbm.c (gd_xbm.c in 7.4) and in the files that re2c made from the changed .re files - backport-xml-toffset-test.patch: GHSA-wg4p-4hqh-c3g9 (a recurrence of bug #72714 in xml_parse_into_struct() with XML_OPTION_SKIP_TAGSTART): the test only; 5.6 is not affected, as it passes the tag name to _xml_add_to_info() through SKIP_TAGSTART(), which bounds the offset. Origin: the test of php-src commit c5e836c (18.12.2024, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports)
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()); the test DatePeriod_uninitialized_interval.phpt of php-src commit 575c10c (25.10.2026, Jamal Tantaoui, the same fix in 7.4), with date.timezone for 5.6 - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-getimagesize.patch: GHSA-3237-qqm7-mfv7 (CVE-2025-14177): getimagesize() reads an APPn segment of a JPEG from a stream in chunks until it has the whole segment, instead of handing back in $imageinfo a buffer that a short read left partly uninitialized (a leak of process memory). Origin: php-src commit 6cf0fb3 (phpGH-20584, 25.11.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test - backport-hostname-nul.patch: GHSA-3cr5-j632-f35r (CVE-2025-1220): a host name with a NUL byte is refused by the socket transports (fsockopen(), stream_socket_client(), the http:// and ftp:// wrappers) with "The hostname must not contain null bytes", instead of being cut at the NUL, so that a check of the whole name and the connection no longer disagree; fsockopen() builds host:port with the length of the host name. Origin: php-src commit d407d8a (10.04.2025, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-http-response-headers.patch: GHSA-v8xr-gpvj-cx9g (CVE-2025-1217), GHSA-pcmh-g36c-qc44 (CVE-2025-1734), GHSA-52jp-hrpf-2jff (CVE-2025-1861) and GHSA-hgf5-96fm-v528 (CVE-2025-1736) for PHP 5.6: the http:// stream wrapper reads the response headers as PHP 7.4 and later do: a folded header (a line that starts with a space or a tab) is joined to the header before it, a header line without a colon, with a space in the header name, starting with a CR or folded before the first header fails the request, a Location header is followed with up to 8182 bytes (5.6 cut it at 1024 bytes) and fails the request when longer, and an Authorization or Proxy-Authorization header of the user is seen only at the start of a header line, so that the one made from the user:password of the URL is no longer left out when the name appears inside another header; with the bounds fixes of phpGH-23467 (CVE-2026-93682) and phpGH-23521 for a relative Location. An empty Location header is not followed, as before in 5.6 (7.4 and later go to /). Origin: port of php-src commits bf4a8df (31.12.2024), 0b965cf (19.01.2025), 134f821 (14.02.2025) and 5418040 (04.03.2025, all Jakub Zelenka), f489702 (24.08.2026, Ilia Alshanetsky) and bd7e19b (31.08.2026, Jordi Kroon) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with their tests and bug47021.phpt and bug75535.phpt of that branch (5.6 had neither), and ext/standard/tests/http/ServerClientTestCase.inc of that branch without the type declarations PHP 5 does not have; the ghsa-hgf5 tests read the request up to its empty line, as 5.6 sends it in several writes; http_empty_location_no_redirect.phpt is ours - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-network-nul.patch: GHSA-www2-q4fc-65wf: checkdnsrr(), dns_check_record(), dns_get_record(), dns_get_mx(), getmxrr(), inet_pton(), ip2long(), getservbyname(), getservbyport() and getprotobyname() refuse an argument with a NUL byte (a warning and NULL, as a path with one) instead of using the part before it; their warning for an argument of the wrong type says "a valid path" instead of "string", as in 7.4. Origin: php-src commit 3e9d47f (06.09.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the variation tests of 5.6 (7.4 has none of them) expect the new warning - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-pgsql-unchecked-escape.patch: GHSA-hrwm-9436-5mv3 (CVE-2025-1735): pgsql and pdo_pgsql check the errors of PQescapeStringConn(), PQescapeByteaConn() and PQescapeIdentifier(): a string that is not valid in the client encoding makes pg_escape_string() throw an exception, pg_insert(), pg_update(), pg_delete(), pg_select() and pg_convert() fail with a notice and PDO::quote() return false, instead of a value escaped only in part going into the query. Origin: port of php-src commit df2ecf3 (04.03.2025, Jakub Zelenka) and of its fix 68c07d5 (25.10.2026: free the escaped string when escaping fails) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests and the test of GHSA-8xr5-qppj-gvwj (cfa5b78, a PDO quote that fails with emulated prepares) - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (5d7c52e), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (5d7c52e): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap-qname.patch: GHSA-453j-q27h-5p8x (CVE-2025-6491): serialize_zval() of ext/soap checks for a NULL node and a NULL node name before comparing the name with "BOGUS". libxml2 before 2.13 leaves the name NULL when it is longer than 2 GB; PHP 5 strings cannot be that long, and the upstream test needs one, so it is not carried. Origin: php-src commit c13a3b2 (03.06.2025, Ahmed Lekssays) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-soap-ref-map.patch: GHSA-85c2-q967-79q5 (CVE-2026-6722): while SoapServer and SoapClient decode a message, the map of the objects that an href can point to holds a reference to each of them, so that an object freed while decoding (an apache:Map item replaced by a later item with the same key) is no longer used by a later href (use after free). PHP 5 counts references on the zval itself, so the result of a SoapClient call is taken over without freeing a zval that the map still holds; an object reached through an href is no longer a PHP reference (var_dump() shows no &), as in PHP 7. Origin: port of php-src commit 6c4b67c (03.05.2026, Ilija Tovilo) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the SoapClient test is ours - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6 - backport-unsigned-char-ctype.patch: GHSA-m8rr-4c36-8gq4 (CVE-2026-7258): every char handed to a ctype.h function (isalpha(), isdigit(), isspace(), tolower(), toupper() and the others) is cast to unsigned char: a byte of 0x80 and above made a negative argument, which the C standard leaves undefined and some C libraries use as an index before their table (FreeBSD and glibc check or allow it). The places of 7.4 that 5.6 does not have are left out. Origin: port of php-src commits b44c4c8 (03.05.2026, Ilija Tovilo) and 2c4b0c4 (25.10.2026: the -d value check of the CLI, CGI, FPM and phpdbg SAPIs) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports); in 5.6 also in ext/gd/libgd/xbm.c (gd_xbm.c in 7.4) and in the files that re2c made from the changed .re files - backport-xml-toffset-test.patch: GHSA-wg4p-4hqh-c3g9 (a recurrence of bug #72714 in xml_parse_into_struct() with XML_OPTION_SKIP_TAGSTART): the test only; 5.6 is not affected, as it passes the tag name to _xml_add_to_info() through SKIP_TAGSTART(), which bounds the offset. Origin: the test of php-src commit c5e836c (18.12.2024, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports)
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()); the test DatePeriod_uninitialized_interval.phpt of php-src commit 575c10c (25.10.2026, Jamal Tantaoui, the same fix in 7.4), with date.timezone for 5.6 - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-getimagesize.patch: GHSA-3237-qqm7-mfv7 (CVE-2025-14177): getimagesize() reads an APPn segment of a JPEG from a stream in chunks until it has the whole segment, instead of handing back in $imageinfo a buffer that a short read left partly uninitialized (a leak of process memory). Origin: php-src commit 6cf0fb3 (phpGH-20584, 25.11.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test - backport-hostname-nul.patch: GHSA-3cr5-j632-f35r (CVE-2025-1220): a host name with a NUL byte is refused by the socket transports (fsockopen(), stream_socket_client(), the http:// and ftp:// wrappers) with "The hostname must not contain null bytes", instead of being cut at the NUL, so that a check of the whole name and the connection no longer disagree; fsockopen() builds host:port with the length of the host name. Origin: php-src commit d407d8a (10.04.2025, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-http-response-headers.patch: GHSA-v8xr-gpvj-cx9g (CVE-2025-1217), GHSA-pcmh-g36c-qc44 (CVE-2025-1734), GHSA-52jp-hrpf-2jff (CVE-2025-1861) and GHSA-hgf5-96fm-v528 (CVE-2025-1736) for PHP 5.6: the http:// stream wrapper reads the response headers as PHP 7.4 and later do: a folded header (a line that starts with a space or a tab) is joined to the header before it, a header line without a colon, with a space in the header name, starting with a CR or folded before the first header fails the request, a Location header is followed with up to 8182 bytes (5.6 cut it at 1024 bytes) and fails the request when longer, and an Authorization or Proxy-Authorization header of the user is seen only at the start of a header line, so that the one made from the user:password of the URL is no longer left out when the name appears inside another header; with the bounds fixes of phpGH-23467 (CVE-2026-93682) and phpGH-23521 for a relative Location. An empty Location header is not followed, as before in 5.6 (7.4 and later go to /). Origin: port of php-src commits bf4a8df (31.12.2024), 0b965cf (19.01.2025), 134f821 (14.02.2025) and 5418040 (04.03.2025, all Jakub Zelenka), f489702 (24.08.2026, Ilia Alshanetsky) and bd7e19b (31.08.2026, Jordi Kroon) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with their tests and bug47021.phpt and bug75535.phpt of that branch (5.6 had neither), and ext/standard/tests/http/ServerClientTestCase.inc of that branch without the type declarations PHP 5 does not have; the ghsa-hgf5 tests read the request up to its empty line, as 5.6 sends it in several writes; http_empty_location_no_redirect.phpt is ours - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-network-nul.patch: GHSA-www2-q4fc-65wf: checkdnsrr(), dns_check_record(), dns_get_record(), dns_get_mx(), getmxrr(), inet_pton(), ip2long(), getservbyname(), getservbyport() and getprotobyname() refuse an argument with a NUL byte (a warning and NULL, as a path with one) instead of using the part before it; their warning for an argument of the wrong type says "a valid path" instead of "string", as in 7.4. Origin: php-src commit 3e9d47f (06.09.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the variation tests of 5.6 (7.4 has none of them) expect the new warning - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-pgsql-unchecked-escape.patch: GHSA-hrwm-9436-5mv3 (CVE-2025-1735): pgsql and pdo_pgsql check the errors of PQescapeStringConn(), PQescapeByteaConn() and PQescapeIdentifier(): a string that is not valid in the client encoding makes pg_escape_string() throw an exception, pg_insert(), pg_update(), pg_delete(), pg_select() and pg_convert() fail with a notice and PDO::quote() return false, instead of a value escaped only in part going into the query. Origin: port of php-src commit df2ecf3 (04.03.2025, Jakub Zelenka) and of its fix 68c07d5 (25.10.2026: free the escaped string when escaping fails) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests and the test of GHSA-8xr5-qppj-gvwj (cfa5b78, a PDO quote that fails with emulated prepares) - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (5d7c52e), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (5d7c52e): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap-qname.patch: GHSA-453j-q27h-5p8x (CVE-2025-6491): serialize_zval() of ext/soap checks for a NULL node and a NULL node name before comparing the name with "BOGUS". libxml2 before 2.13 leaves the name NULL when it is longer than 2 GB; PHP 5 strings cannot be that long, and the upstream test needs one, so it is not carried. Origin: php-src commit c13a3b2 (03.06.2025, Ahmed Lekssays) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-soap-ref-map.patch: GHSA-85c2-q967-79q5 (CVE-2026-6722): while SoapServer and SoapClient decode a message, the map of the objects that an href can point to holds a reference to each of them, so that an object freed while decoding (an apache:Map item replaced by a later item with the same key) is no longer used by a later href (use after free). PHP 5 counts references on the zval itself, so the result of a SoapClient call is taken over without freeing a zval that the map still holds; an object reached through an href is no longer a PHP reference (var_dump() shows no &), as in PHP 7. Origin: port of php-src commit 6c4b67c (03.05.2026, Ilija Tovilo) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the SoapClient test is ours - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6 - backport-unsigned-char-ctype.patch: GHSA-m8rr-4c36-8gq4 (CVE-2026-7258): every char handed to a ctype.h function (isalpha(), isdigit(), isspace(), tolower(), toupper() and the others) is cast to unsigned char: a byte of 0x80 and above made a negative argument, which the C standard leaves undefined and some C libraries use as an index before their table (FreeBSD and glibc check or allow it). The places of 7.4 that 5.6 does not have are left out. Origin: port of php-src commits b44c4c8 (03.05.2026, Ilija Tovilo) and 2c4b0c4 (25.10.2026: the -d value check of the CLI, CGI, FPM and phpdbg SAPIs) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports); in 5.6 also in ext/gd/libgd/xbm.c (gd_xbm.c in 7.4) and in the files that re2c made from the changed .re files - backport-xml-toffset-test.patch: GHSA-wg4p-4hqh-c3g9 (a recurrence of bug #72714 in xml_parse_into_struct() with XML_OPTION_SKIP_TAGSTART): the test only; 5.6 is not affected, as it passes the tag name to _xml_add_to_info() through SKIP_TAGSTART(), which bounds the offset. Origin: the test of php-src commit c5e836c (18.12.2024, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports)
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()); the test DatePeriod_uninitialized_interval.phpt of php-src commit 575c10c (25.10.2026, Jamal Tantaoui, the same fix in 7.4), with date.timezone for 5.6 - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-getimagesize.patch: GHSA-3237-qqm7-mfv7 (CVE-2025-14177): getimagesize() reads an APPn segment of a JPEG from a stream in chunks until it has the whole segment, instead of handing back in $imageinfo a buffer that a short read left partly uninitialized (a leak of process memory). Origin: php-src commit 6cf0fb3 (phpGH-20584, 25.11.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test - backport-hostname-nul.patch: GHSA-3cr5-j632-f35r (CVE-2025-1220): a host name with a NUL byte is refused by the socket transports (fsockopen(), stream_socket_client(), the http:// and ftp:// wrappers) with "The hostname must not contain null bytes", instead of being cut at the NUL, so that a check of the whole name and the connection no longer disagree; fsockopen() builds host:port with the length of the host name. Origin: php-src commit d407d8a (10.04.2025, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-http-response-headers.patch: GHSA-v8xr-gpvj-cx9g (CVE-2025-1217), GHSA-pcmh-g36c-qc44 (CVE-2025-1734), GHSA-52jp-hrpf-2jff (CVE-2025-1861) and GHSA-hgf5-96fm-v528 (CVE-2025-1736) for PHP 5.6: the http:// stream wrapper reads the response headers as PHP 7.4 and later do: a folded header (a line that starts with a space or a tab) is joined to the header before it, a header line without a colon, with a space in the header name, starting with a CR or folded before the first header fails the request, a Location header is followed with up to 8182 bytes (5.6 cut it at 1024 bytes) and fails the request when longer, and an Authorization or Proxy-Authorization header of the user is seen only at the start of a header line, so that the one made from the user:password of the URL is no longer left out when the name appears inside another header; with the bounds fixes of phpGH-23467 (CVE-2026-93682) and phpGH-23521 for a relative Location. An empty Location header is not followed, as before in 5.6 (7.4 and later go to /). Origin: port of php-src commits bf4a8df (31.12.2024), 0b965cf (19.01.2025), 134f821 (14.02.2025) and 5418040 (04.03.2025, all Jakub Zelenka), f489702 (24.08.2026, Ilia Alshanetsky) and bd7e19b (31.08.2026, Jordi Kroon) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with their tests and bug47021.phpt and bug75535.phpt of that branch (5.6 had neither), and ext/standard/tests/http/ServerClientTestCase.inc of that branch without the type declarations PHP 5 does not have; the ghsa-hgf5 tests read the request up to its empty line, as 5.6 sends it in several writes; http_empty_location_no_redirect.phpt is ours - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-network-nul.patch: GHSA-www2-q4fc-65wf: checkdnsrr(), dns_check_record(), dns_get_record(), dns_get_mx(), getmxrr(), inet_pton(), ip2long(), getservbyname(), getservbyport() and getprotobyname() refuse an argument with a NUL byte (a warning and NULL, as a path with one) instead of using the part before it; their warning for an argument of the wrong type says "a valid path" instead of "string", as in 7.4. Origin: php-src commit 3e9d47f (06.09.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the variation tests of 5.6 (7.4 has none of them) expect the new warning - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-pgsql-unchecked-escape.patch: GHSA-hrwm-9436-5mv3 (CVE-2025-1735): pgsql and pdo_pgsql check the errors of PQescapeStringConn(), PQescapeByteaConn() and PQescapeIdentifier(): a string that is not valid in the client encoding makes pg_escape_string() throw an exception, pg_insert(), pg_update(), pg_delete(), pg_select() and pg_convert() fail with a notice and PDO::quote() return false, instead of a value escaped only in part going into the query. Origin: port of php-src commit df2ecf3 (04.03.2025, Jakub Zelenka) and of its fix 68c07d5 (25.10.2026: free the escaped string when escaping fails) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests and the test of GHSA-8xr5-qppj-gvwj (cfa5b78, a PDO quote that fails with emulated prepares) - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (5d7c52e), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (5d7c52e): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap-qname.patch: GHSA-453j-q27h-5p8x (CVE-2025-6491): serialize_zval() of ext/soap checks for a NULL node and a NULL node name before comparing the name with "BOGUS". libxml2 before 2.13 leaves the name NULL when it is longer than 2 GB; PHP 5 strings cannot be that long, and the upstream test needs one, so it is not carried. Origin: php-src commit c13a3b2 (03.06.2025, Ahmed Lekssays) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-soap-ref-map.patch: GHSA-85c2-q967-79q5 (CVE-2026-6722): while SoapServer and SoapClient decode a message, the map of the objects that an href can point to holds a reference to each of them, so that an object freed while decoding (an apache:Map item replaced by a later item with the same key) is no longer used by a later href (use after free). PHP 5 counts references on the zval itself, so the result of a SoapClient call is taken over without freeing a zval that the map still holds; an object reached through an href is no longer a PHP reference (var_dump() shows no &), as in PHP 7. Origin: port of php-src commit 6c4b67c (03.05.2026, Ilija Tovilo) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the SoapClient test is ours - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6 - backport-unsigned-char-ctype.patch: GHSA-m8rr-4c36-8gq4 (CVE-2026-7258): every char handed to a ctype.h function (isalpha(), isdigit(), isspace(), tolower(), toupper() and the others) is cast to unsigned char: a byte of 0x80 and above made a negative argument, which the C standard leaves undefined and some C libraries use as an index before their table (FreeBSD and glibc check or allow it). The places of 7.4 that 5.6 does not have are left out. Origin: port of php-src commits b44c4c8 (03.05.2026, Ilija Tovilo) and 2c4b0c4 (25.10.2026: the -d value check of the CLI, CGI, FPM and phpdbg SAPIs) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports); in 5.6 also in ext/gd/libgd/xbm.c (gd_xbm.c in 7.4) and in the files that re2c made from the changed .re files - backport-xml-toffset-test.patch: GHSA-wg4p-4hqh-c3g9 (a recurrence of bug #72714 in xml_parse_into_struct() with XML_OPTION_SKIP_TAGSTART): the test only; 5.6 is not affected, as it passes the tag name to _xml_add_to_info() through SKIP_TAGSTART(), which bounds the offset. Origin: the test of php-src commit c5e836c (18.12.2024, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports)
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()); the test DatePeriod_uninitialized_interval.phpt of php-src commit 575c10c (25.10.2026, Jamal Tantaoui, the same fix in 7.4), with date.timezone for 5.6 - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-getimagesize.patch: GHSA-3237-qqm7-mfv7 (CVE-2025-14177): getimagesize() reads an APPn segment of a JPEG from a stream in chunks until it has the whole segment, instead of handing back in $imageinfo a buffer that a short read left partly uninitialized (a leak of process memory). Origin: php-src commit 6cf0fb3 (phpGH-20584, 25.11.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test - backport-hostname-nul.patch: GHSA-3cr5-j632-f35r (CVE-2025-1220): a host name with a NUL byte is refused by the socket transports (fsockopen(), stream_socket_client(), the http:// and ftp:// wrappers) with "The hostname must not contain null bytes", instead of being cut at the NUL, so that a check of the whole name and the connection no longer disagree; fsockopen() builds host:port with the length of the host name. Origin: php-src commit d407d8a (10.04.2025, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-http-response-headers.patch: GHSA-v8xr-gpvj-cx9g (CVE-2025-1217), GHSA-pcmh-g36c-qc44 (CVE-2025-1734), GHSA-52jp-hrpf-2jff (CVE-2025-1861) and GHSA-hgf5-96fm-v528 (CVE-2025-1736) for PHP 5.6: the http:// stream wrapper reads the response headers as PHP 7.4 and later do: a folded header (a line that starts with a space or a tab) is joined to the header before it, a header line without a colon, with a space in the header name, starting with a CR or folded before the first header fails the request, a Location header is followed with up to 8182 bytes (5.6 cut it at 1024 bytes) and fails the request when longer, and an Authorization or Proxy-Authorization header of the user is seen only at the start of a header line, so that the one made from the user:password of the URL is no longer left out when the name appears inside another header; with the bounds fixes of phpGH-23467 (CVE-2026-93682) and phpGH-23521 for a relative Location. An empty Location header is not followed, as before in 5.6 (7.4 and later go to /). Origin: port of php-src commits bf4a8df (31.12.2024), 0b965cf (19.01.2025), 134f821 (14.02.2025) and 5418040 (04.03.2025, all Jakub Zelenka), f489702 (24.08.2026, Ilia Alshanetsky) and bd7e19b (31.08.2026, Jordi Kroon) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with their tests and bug47021.phpt and bug75535.phpt of that branch (5.6 had neither), and ext/standard/tests/http/ServerClientTestCase.inc of that branch without the type declarations PHP 5 does not have; the ghsa-hgf5 tests read the request up to its empty line, as 5.6 sends it in several writes; http_empty_location_no_redirect.phpt is ours - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-network-nul.patch: GHSA-www2-q4fc-65wf: checkdnsrr(), dns_check_record(), dns_get_record(), dns_get_mx(), getmxrr(), inet_pton(), ip2long(), getservbyname(), getservbyport() and getprotobyname() refuse an argument with a NUL byte (a warning and NULL, as a path with one) instead of using the part before it; their warning for an argument of the wrong type says "a valid path" instead of "string", as in 7.4. Origin: php-src commit 3e9d47f (06.09.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the variation tests of 5.6 (7.4 has none of them) expect the new warning - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-pgsql-unchecked-escape.patch: GHSA-hrwm-9436-5mv3 (CVE-2025-1735): pgsql and pdo_pgsql check the errors of PQescapeStringConn(), PQescapeByteaConn() and PQescapeIdentifier(): a string that is not valid in the client encoding makes pg_escape_string() throw an exception, pg_insert(), pg_update(), pg_delete(), pg_select() and pg_convert() fail with a notice and PDO::quote() return false, instead of a value escaped only in part going into the query. Origin: port of php-src commit df2ecf3 (04.03.2025, Jakub Zelenka) and of its fix 68c07d5 (25.10.2026: free the escaped string when escaping fails) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests and the test of GHSA-8xr5-qppj-gvwj (cfa5b78, a PDO quote that fails with emulated prepares) - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (5d7c52e), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (5d7c52e): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap-qname.patch: GHSA-453j-q27h-5p8x (CVE-2025-6491): serialize_zval() of ext/soap checks for a NULL node and a NULL node name before comparing the name with "BOGUS". libxml2 before 2.13 leaves the name NULL when it is longer than 2 GB; PHP 5 strings cannot be that long, and the upstream test needs one, so it is not carried. Origin: php-src commit c13a3b2 (03.06.2025, Ahmed Lekssays) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-soap-ref-map.patch: GHSA-85c2-q967-79q5 (CVE-2026-6722): while SoapServer and SoapClient decode a message, the map of the objects that an href can point to holds a reference to each of them, so that an object freed while decoding (an apache:Map item replaced by a later item with the same key) is no longer used by a later href (use after free). PHP 5 counts references on the zval itself, so the result of a SoapClient call is taken over without freeing a zval that the map still holds; an object reached through an href is no longer a PHP reference (var_dump() shows no &), as in PHP 7. Origin: port of php-src commit 6c4b67c (03.05.2026, Ilija Tovilo) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the SoapClient test is ours - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6 - backport-unsigned-char-ctype.patch: GHSA-m8rr-4c36-8gq4 (CVE-2026-7258): every char handed to a ctype.h function (isalpha(), isdigit(), isspace(), tolower(), toupper() and the others) is cast to unsigned char: a byte of 0x80 and above made a negative argument, which the C standard leaves undefined and some C libraries use as an index before their table (FreeBSD and glibc check or allow it). The places of 7.4 that 5.6 does not have are left out. Origin: port of php-src commits b44c4c8 (03.05.2026, Ilija Tovilo) and 2c4b0c4 (25.10.2026: the -d value check of the CLI, CGI, FPM and phpdbg SAPIs) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports); in 5.6 also in ext/gd/libgd/xbm.c (gd_xbm.c in 7.4) and in the files that re2c made from the changed .re files - backport-xml-toffset-test.patch: GHSA-wg4p-4hqh-c3g9 (a recurrence of bug #72714 in xml_parse_into_struct() with XML_OPTION_SKIP_TAGSTART): the test only; 5.6 is not affected, as it passes the tag name to _xml_add_to_info() through SKIP_TAGSTART(), which bounds the offset. Origin: the test of php-src commit c5e836c (18.12.2024, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports)
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()); the test DatePeriod_uninitialized_interval.phpt of php-src commit 575c10c (25.10.2026, Jamal Tantaoui, the same fix in 7.4), with date.timezone for 5.6 - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-getimagesize.patch: GHSA-3237-qqm7-mfv7 (CVE-2025-14177): getimagesize() reads an APPn segment of a JPEG from a stream in chunks until it has the whole segment, instead of handing back in $imageinfo a buffer that a short read left partly uninitialized (a leak of process memory). Origin: php-src commit 6cf0fb3 (phpGH-20584, 25.11.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test - backport-hostname-nul.patch: GHSA-3cr5-j632-f35r (CVE-2025-1220): a host name with a NUL byte is refused by the socket transports (fsockopen(), stream_socket_client(), the http:// and ftp:// wrappers) with "The hostname must not contain null bytes", instead of being cut at the NUL, so that a check of the whole name and the connection no longer disagree; fsockopen() builds host:port with the length of the host name. Origin: php-src commit d407d8a (10.04.2025, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-http-response-headers.patch: GHSA-v8xr-gpvj-cx9g (CVE-2025-1217), GHSA-pcmh-g36c-qc44 (CVE-2025-1734), GHSA-52jp-hrpf-2jff (CVE-2025-1861) and GHSA-hgf5-96fm-v528 (CVE-2025-1736) for PHP 5.6: the http:// stream wrapper reads the response headers as PHP 7.4 and later do: a folded header (a line that starts with a space or a tab) is joined to the header before it, a header line without a colon, with a space in the header name, starting with a CR or folded before the first header fails the request, a Location header is followed with up to 8182 bytes (5.6 cut it at 1024 bytes) and fails the request when longer, and an Authorization or Proxy-Authorization header of the user is seen only at the start of a header line, so that the one made from the user:password of the URL is no longer left out when the name appears inside another header; with the bounds fixes of phpGH-23467 (CVE-2026-93682) and phpGH-23521 for a relative Location. An empty Location header is not followed, as before in 5.6 (7.4 and later go to /). Origin: port of php-src commits bf4a8df (31.12.2024), 0b965cf (19.01.2025), 134f821 (14.02.2025) and 5418040 (04.03.2025, all Jakub Zelenka), f489702 (24.08.2026, Ilia Alshanetsky) and bd7e19b (31.08.2026, Jordi Kroon) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with their tests and bug47021.phpt and bug75535.phpt of that branch (5.6 had neither), and ext/standard/tests/http/ServerClientTestCase.inc of that branch without the type declarations PHP 5 does not have; the ghsa-hgf5 tests read the request up to its empty line, as 5.6 sends it in several writes; http_empty_location_no_redirect.phpt is ours - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-network-nul.patch: GHSA-www2-q4fc-65wf: checkdnsrr(), dns_check_record(), dns_get_record(), dns_get_mx(), getmxrr(), inet_pton(), ip2long(), getservbyname(), getservbyport() and getprotobyname() refuse an argument with a NUL byte (a warning and NULL, as a path with one) instead of using the part before it; their warning for an argument of the wrong type says "a valid path" instead of "string", as in 7.4. Origin: php-src commit 3e9d47f (06.09.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the variation tests of 5.6 (7.4 has none of them) expect the new warning - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-pgsql-unchecked-escape.patch: GHSA-hrwm-9436-5mv3 (CVE-2025-1735): pgsql and pdo_pgsql check the errors of PQescapeStringConn(), PQescapeByteaConn() and PQescapeIdentifier(): a string that is not valid in the client encoding makes pg_escape_string() throw an exception, pg_insert(), pg_update(), pg_delete(), pg_select() and pg_convert() fail with a notice and PDO::quote() return false, instead of a value escaped only in part going into the query. Origin: port of php-src commit df2ecf3 (04.03.2025, Jakub Zelenka) and of its fix 68c07d5 (25.10.2026: free the escaped string when escaping fails) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests and the test of GHSA-8xr5-qppj-gvwj (cfa5b78, a PDO quote that fails with emulated prepares) - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (5d7c52e), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (5d7c52e): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap-qname.patch: GHSA-453j-q27h-5p8x (CVE-2025-6491): serialize_zval() of ext/soap checks for a NULL node and a NULL node name before comparing the name with "BOGUS". libxml2 before 2.13 leaves the name NULL when it is longer than 2 GB; PHP 5 strings cannot be that long, and the upstream test needs one, so it is not carried. Origin: php-src commit c13a3b2 (03.06.2025, Ahmed Lekssays) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-soap-ref-map.patch: GHSA-85c2-q967-79q5 (CVE-2026-6722): while SoapServer and SoapClient decode a message, the map of the objects that an href can point to holds a reference to each of them, so that an object freed while decoding (an apache:Map item replaced by a later item with the same key) is no longer used by a later href (use after free). PHP 5 counts references on the zval itself, so the result of a SoapClient call is taken over without freeing a zval that the map still holds; an object reached through an href is no longer a PHP reference (var_dump() shows no &), as in PHP 7. Origin: port of php-src commit 6c4b67c (03.05.2026, Ilija Tovilo) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the SoapClient test is ours - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6 - backport-unsigned-char-ctype.patch: GHSA-m8rr-4c36-8gq4 (CVE-2026-7258): every char handed to a ctype.h function (isalpha(), isdigit(), isspace(), tolower(), toupper() and the others) is cast to unsigned char: a byte of 0x80 and above made a negative argument, which the C standard leaves undefined and some C libraries use as an index before their table (FreeBSD and glibc check or allow it). The places of 7.4 that 5.6 does not have are left out. Origin: port of php-src commits b44c4c8 (03.05.2026, Ilija Tovilo) and 2c4b0c4 (25.10.2026: the -d value check of the CLI, CGI, FPM and phpdbg SAPIs) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports); in 5.6 also in ext/gd/libgd/xbm.c (gd_xbm.c in 7.4) and in the files that re2c made from the changed .re files - backport-xml-toffset-test.patch: GHSA-wg4p-4hqh-c3g9 (a recurrence of bug #72714 in xml_parse_into_struct() with XML_OPTION_SKIP_TAGSTART): the test only; 5.6 is not affected, as it passes the tag name to _xml_add_to_info() through SKIP_TAGSTART(), which bounds the offset. Origin: the test of php-src commit c5e836c (18.12.2024, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports)
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()); the test DatePeriod_uninitialized_interval.phpt of php-src commit 575c10c (25.10.2026, Jamal Tantaoui, the same fix in 7.4), with date.timezone for 5.6 - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-getimagesize.patch: GHSA-3237-qqm7-mfv7 (CVE-2025-14177): getimagesize() reads an APPn segment of a JPEG from a stream in chunks until it has the whole segment, instead of handing back in $imageinfo a buffer that a short read left partly uninitialized (a leak of process memory). Origin: php-src commit 6cf0fb3 (phpGH-20584, 25.11.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test - backport-hostname-nul.patch: GHSA-3cr5-j632-f35r (CVE-2025-1220): a host name with a NUL byte is refused by the socket transports (fsockopen(), stream_socket_client(), the http:// and ftp:// wrappers) with "The hostname must not contain null bytes", instead of being cut at the NUL, so that a check of the whole name and the connection no longer disagree; fsockopen() builds host:port with the length of the host name. Origin: php-src commit d407d8a (10.04.2025, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-http-response-headers.patch: GHSA-v8xr-gpvj-cx9g (CVE-2025-1217), GHSA-pcmh-g36c-qc44 (CVE-2025-1734), GHSA-52jp-hrpf-2jff (CVE-2025-1861) and GHSA-hgf5-96fm-v528 (CVE-2025-1736) for PHP 5.6: the http:// stream wrapper reads the response headers as PHP 7.4 and later do: a folded header (a line that starts with a space or a tab) is joined to the header before it, a header line without a colon, with a space in the header name, starting with a CR or folded before the first header fails the request, a Location header is followed with up to 8182 bytes (5.6 cut it at 1024 bytes) and fails the request when longer, and an Authorization or Proxy-Authorization header of the user is seen only at the start of a header line, so that the one made from the user:password of the URL is no longer left out when the name appears inside another header; with the bounds fixes of phpGH-23467 (CVE-2026-93682) and phpGH-23521 for a relative Location. An empty Location header is not followed, as before in 5.6 (7.4 and later go to /). Origin: port of php-src commits bf4a8df (31.12.2024), 0b965cf (19.01.2025), 134f821 (14.02.2025) and 5418040 (04.03.2025, all Jakub Zelenka), f489702 (24.08.2026, Ilia Alshanetsky) and bd7e19b (31.08.2026, Jordi Kroon) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with their tests and bug47021.phpt and bug75535.phpt of that branch (5.6 had neither), and ext/standard/tests/http/ServerClientTestCase.inc of that branch without the type declarations PHP 5 does not have; the ghsa-hgf5 tests read the request up to its empty line, as 5.6 sends it in several writes; http_empty_location_no_redirect.phpt is ours - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-network-nul.patch: GHSA-www2-q4fc-65wf: checkdnsrr(), dns_check_record(), dns_get_record(), dns_get_mx(), getmxrr(), inet_pton(), ip2long(), getservbyname(), getservbyport() and getprotobyname() refuse an argument with a NUL byte (a warning and NULL, as a path with one) instead of using the part before it; their warning for an argument of the wrong type says "a valid path" instead of "string", as in 7.4. Origin: php-src commit 3e9d47f (06.09.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the variation tests of 5.6 (7.4 has none of them) expect the new warning - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-pgsql-unchecked-escape.patch: GHSA-hrwm-9436-5mv3 (CVE-2025-1735): pgsql and pdo_pgsql check the errors of PQescapeStringConn(), PQescapeByteaConn() and PQescapeIdentifier(): a string that is not valid in the client encoding makes pg_escape_string() throw an exception, pg_insert(), pg_update(), pg_delete(), pg_select() and pg_convert() fail with a notice and PDO::quote() return false, instead of a value escaped only in part going into the query. Origin: port of php-src commit df2ecf3 (04.03.2025, Jakub Zelenka) and of its fix 68c07d5 (25.10.2026: free the escaped string when escaping fails) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests and the test of GHSA-8xr5-qppj-gvwj (cfa5b78, a PDO quote that fails with emulated prepares) - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (5d7c52e), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (5d7c52e): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap-qname.patch: GHSA-453j-q27h-5p8x (CVE-2025-6491): serialize_zval() of ext/soap checks for a NULL node and a NULL node name before comparing the name with "BOGUS". libxml2 before 2.13 leaves the name NULL when it is longer than 2 GB; PHP 5 strings cannot be that long, and the upstream test needs one, so it is not carried. Origin: php-src commit c13a3b2 (03.06.2025, Ahmed Lekssays) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-soap-ref-map.patch: GHSA-85c2-q967-79q5 (CVE-2026-6722): while SoapServer and SoapClient decode a message, the map of the objects that an href can point to holds a reference to each of them, so that an object freed while decoding (an apache:Map item replaced by a later item with the same key) is no longer used by a later href (use after free). PHP 5 counts references on the zval itself, so the result of a SoapClient call is taken over without freeing a zval that the map still holds; an object reached through an href is no longer a PHP reference (var_dump() shows no &), as in PHP 7. Origin: port of php-src commit 6c4b67c (03.05.2026, Ilija Tovilo) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the SoapClient test is ours - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6 - backport-unsigned-char-ctype.patch: GHSA-m8rr-4c36-8gq4 (CVE-2026-7258): every char handed to a ctype.h function (isalpha(), isdigit(), isspace(), tolower(), toupper() and the others) is cast to unsigned char: a byte of 0x80 and above made a negative argument, which the C standard leaves undefined and some C libraries use as an index before their table (FreeBSD and glibc check or allow it). The places of 7.4 that 5.6 does not have are left out. Origin: port of php-src commits b44c4c8 (03.05.2026, Ilija Tovilo) and 2c4b0c4 (25.10.2026: the -d value check of the CLI, CGI, FPM and phpdbg SAPIs) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports); in 5.6 also in ext/gd/libgd/xbm.c (gd_xbm.c in 7.4) and in the files that re2c made from the changed .re files - backport-xml-toffset-test.patch: GHSA-wg4p-4hqh-c3g9 (a recurrence of bug #72714 in xml_parse_into_struct() with XML_OPTION_SKIP_TAGSTART): the test only; 5.6 is not affected, as it passes the tag name to _xml_add_to_info() through SKIP_TAGSTART(), which bounds the offset. Origin: the test of php-src commit c5e836c (18.12.2024, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports)
Interim backports carried until the upstream branch has its own fix: - backport-convert-filters.patch: GHSA-88hq-2827-7pg6: the convert.base64-encode, convert.quoted-printable-encode and convert.quoted-printable-decode stream filters copy their line-break-chars option with its length (pestrndup()), so that a value with a NUL byte no longer leads to a heap buffer over-read. Origin: php-src commit 8d933a6 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.02.2026, geeknik, cherry-pick of b4e3397), applies to 5.6 as it is - backport-date-period.patch: DatePeriod::__construct() called again on the same object frees the start, current, end and interval of the first call instead of leaking them (phpGH-22643), and refuses a DateInterval, or a start or end date, that was not initialized by its constructor (a subclass that overrides it without calling the parent) instead of reading through a NULL pointer; unlike the 7.4 version it restores the error handling mode on that path, so that later warnings do not turn into exceptions. Origin: php-src commit bbb0272 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (07.07.2026, Ilija Tovilo), adapted to the PHP 5.6 object layout; the check of the start and end dates is added here (5.6 copies the start time with memcpy()); the test DatePeriod_uninitialized_interval.phpt of php-src commit 575c10c (25.10.2026, Jamal Tantaoui, the same fix in 7.4), with date.timezone for 5.6 - backport-filter-encoded.patch: GHSA-ch8v-r6jh-4vvr: FILTER_SANITIZE_ENCODED percent-encodes 0xFF (its table of characters to keep was one byte short and left 0xFF as it is). Origin: php-src commit f517508 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (29.07.2026, Ilia Alshanetsky), applies to 5.6 as it is - backport-fpm-allowed-clients.patch: GHSA-62xp-839h-2637: listen.allowed_clients of php-fpm compared only the first 96 bits of an IPv6 client address, so that an allowed ::dead:beef let ::1 in; all 128 bits are compared now. Origin: php-src commit 7fb8053 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (25.08.2026, Alexandre Daubois), in sapi/fpm/fpm/fastcgi.c of 5.6 (main/fastcgi.c of 7.x); the test is rewritten for the FPM test helpers of 5.6, the IPv4-mapped one is left out (php-fpm 5.6 does not clear IPV6_V6ONLY, which FreeBSD sets by default) - backport-gd-gif-lzw.patch: CVE-2026-9672: the GIF LZW decoder of the bundled libgd (imagecreatefromgif()) clears every entry of its code table on a clear code (it cleared table[1][0] over and over and left the other entries stale), stops at the end code instead of decoding on with a stale code, and starts from a zeroed state, so that a crafted GIF cannot make it read uninitialized memory. Origin: php-src commit e9413a5 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (28.07.2026, libgd fix fcd691b by Pierre Joye), applies to 5.6 as it is - backport-getimagesize.patch: GHSA-3237-qqm7-mfv7 (CVE-2025-14177): getimagesize() reads an APPn segment of a JPEG from a stream in chunks until it has the whole segment, instead of handing back in $imageinfo a buffer that a short read left partly uninitialized (a leak of process memory). Origin: php-src commit 6cf0fb3 (phpGH-20584, 25.11.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test - backport-hostname-nul.patch: GHSA-3cr5-j632-f35r (CVE-2025-1220): a host name with a NUL byte is refused by the socket transports (fsockopen(), stream_socket_client(), the http:// and ftp:// wrappers) with "The hostname must not contain null bytes", instead of being cut at the NUL, so that a check of the whole name and the connection no longer disagree; fsockopen() builds host:port with the length of the host name. Origin: php-src commit d407d8a (10.04.2025, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests - backport-http-redirects.patch: GHSA-fpwc-w8rq-cr92: on a redirect to another origin (scheme, host or port) the http:// stream wrapper drops Authorization, Cookie and Proxy-Authorization from the header option of the context, repeated headers, folded values and whitespace before the colon included; with it phpGH-11274: 307 and 308 redirects keep the method (POST, PATCH) and the body, as RFC 7231 and RFC 7538 require. The fixes of 7.4 for an empty and a 1-character Location (phpGH-23467, phpGH-23521) do not apply: 5.6 does not follow an empty Location and reads it from a fixed-size buffer. Origin: php-src commits c812ca1 (phpGH-11274, Niels Dossche) and dc1f36a (14.09.2026, Alexandre Daubois, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-http-response-headers.patch: GHSA-v8xr-gpvj-cx9g (CVE-2025-1217), GHSA-pcmh-g36c-qc44 (CVE-2025-1734), GHSA-52jp-hrpf-2jff (CVE-2025-1861) and GHSA-hgf5-96fm-v528 (CVE-2025-1736) for PHP 5.6: the http:// stream wrapper reads the response headers as PHP 7.4 and later do: a folded header (a line that starts with a space or a tab) is joined to the header before it, a header line without a colon, with a space in the header name, starting with a CR or folded before the first header fails the request, a Location header is followed with up to 8182 bytes (5.6 cut it at 1024 bytes) and fails the request when longer, and an Authorization or Proxy-Authorization header of the user is seen only at the start of a header line, so that the one made from the user:password of the URL is no longer left out when the name appears inside another header; with the bounds fixes of phpGH-23467 (CVE-2026-93682) and phpGH-23521 for a relative Location. An empty Location header is not followed, as before in 5.6 (7.4 and later go to /). Origin: port of php-src commits bf4a8df (31.12.2024), 0b965cf (19.01.2025), 134f821 (14.02.2025) and 5418040 (04.03.2025, all Jakub Zelenka), f489702 (24.08.2026, Ilia Alshanetsky) and bd7e19b (31.08.2026, Jordi Kroon) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with their tests and bug47021.phpt and bug75535.phpt of that branch (5.6 had neither), and ext/standard/tests/http/ServerClientTestCase.inc of that branch without the type declarations PHP 5 does not have; the ghsa-hgf5 tests read the request up to its empty line, as 5.6 sends it in several writes; http_empty_location_no_redirect.phpt is ours - backport-mysqlnd-overread.patch: GHSA-h35g-vwh6-m678 (CVE-2024-8929, 2024) and the 2026 partial fix of GHSA-r6x9-5r99-36j7 for PHP 5.6: a hostile or man-in-the-middle MySQL server could make the mysqlnd client read past the end of a received packet and leak adjacent heap bytes into PHP-visible values, and in some paths free memory wrongly. 5.6 shipped neither fix (both are absent from Remi and Sury for 5.6), so both are carried over from PHP 7.4. php_mysqlnd_net_field_length() now takes the bytes left in the packet and returns MYSQLND_INVALID_NET_FIELD_LENGTH when a length-encoded integer would read past them; a new php_mysqlnd_net_field_length_ll() returns an optional value the callers must check. Every packet reader (greeting, auth response, OK, EOF, result-set header, column definition, prepare response, change-user, sha256 public key, and the text and binary row decoders) is bounded with BAIL_IF_NOT_ENOUGH_DATA_EX / explicit remaining-size checks, NUL-terminated strings are found with memchr instead of being assumed terminated, and the prepared-statement value decoders (ps_fetch_*) reject a declared length that runs past the row or is too short for the fixed type. A decode that fails frees or NULLs the already-decoded row zvals of 5.6 so the row can be freed safely, the BIT text value is bounded by the space reserved from the column length, read_result_metadata frees a failed result through free_result (not a bare efree that would leak the sub-objects), and the prepared-statement EOF reset releases the connection reference and command buffer before the memset. Tests use a new fake MySQL server (ext/mysqli/tests/fake_server.inc), adapted to PHP 5.6 syntax; the client handshake bytes that differ in 5.6 are matched with %s. Origin: azsupport, port of php-src commits 2f5aa9f (GHSA-h35g-vwh6-m678 / CVE-2024-8929, Jakub Zelenka, 08.10.2024, PHP-8.1) and 2af14de (Partial Fix GHSA-r6x9-5r99-36j7, Jakub Zelenka and Nora Dossche, 12.07.2026) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-network-nul.patch: GHSA-www2-q4fc-65wf: checkdnsrr(), dns_check_record(), dns_get_record(), dns_get_mx(), getmxrr(), inet_pton(), ip2long(), getservbyname(), getservbyport() and getprotobyname() refuse an argument with a NUL byte (a warning and NULL, as a path with one) instead of using the part before it; their warning for an argument of the wrong type says "a valid path" instead of "string", as in 7.4. Origin: php-src commit 3e9d47f (06.09.2025, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the variation tests of 5.6 (7.4 has none of them) expect the new warning - backport-openssl-peer-name.patch: GHSA-vvx9-73fr-5jjx: the peer name check of TLS streams no longer falls back to the CN when the certificate presents a DNS-ID, URI-ID or SRV-ID (RFC 6125 6.4.4); GHSA-xr7j-rvgx-xq5p: out-of-bounds read in the wildcard match when the wildcard prefix and suffix overlap in the name (CN "a*aaaa" against "aaaa"). The tests come with CertificateGenerator.inc of 7.4. Origin: php-src commits da1db02 and dbc0299 of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (10.08.2026, Jakub Zelenka) - backport-pgsql-quotes.patch: GHSA-7qpv-r5mr-78m4 (CVE-2026-17543): SQL injection through pg_convert(), pg_insert(), pg_update(), pg_delete() and pg_select(): values escaped with PQescapeStringConn() were quoted as E'...', where a backslash escapes the quote, while PQescapeStringConn() doubles backslashes only with standard_conforming_strings off; they are quoted as '...' now. Origin: php-src commit 6a80d9d of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) (27.07.2026, Ilija Tovilo, cherry-pick of ab048bd), with the expected results of the pgsql tests - backport-pgsql-unchecked-escape.patch: GHSA-hrwm-9436-5mv3 (CVE-2025-1735): pgsql and pdo_pgsql check the errors of PQescapeStringConn(), PQescapeByteaConn() and PQescapeIdentifier(): a string that is not valid in the client encoding makes pg_escape_string() throw an exception, pg_insert(), pg_update(), pg_delete(), pg_select() and pg_convert() fail with a notice and PDO::quote() return false, instead of a value escaped only in part going into the query. Origin: port of php-src commit df2ecf3 (04.03.2025, Jakub Zelenka) and of its fix 68c07d5 (25.10.2026: free the escaped string when escaping fails) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its tests and the test of GHSA-8xr5-qppj-gvwj (cfa5b78, a PDO quote that fails with emulated prepares) - backport-phar-tar.patch: GHSA-vc5h-9ppw-p5f3 (CVE-2026-7260): a tar archive with a loop of symbolic links no longer exhausts the stack (phar_get_link_source() follows the chain without recursion, with Floyd's cycle detection; a loop resolves to nothing). GHSA-j3wh-g957-2m85: tar entry injection: an entry size that is not plain octal (overflow, GNU base-256, other characters) is refused instead of being read as some other size, entries that carry no data (links, devices, directories, FIFOs) no longer skip data, GNU long link records are refused and a long name longer than the archive is rejected. The test of GHSA-vc5h writes its archives itself, as patch(1) cannot add the binary ones of upstream. Origin: php-src commits 6982130 (03.05.2026) and f3432d2 (13.09.2026, both Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), ported to the PHP 5 API - backport-php2shell-1.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6: the official EOL fix "Avoid state corruption via bailout" (PHP 7.4) carried over to the PHP 5 engine, as proposed for remicollet/php-src-security in pull request #32: fatal errors of the allocator (memory limit, integer overflow in allocation sizes, string size overflow in concatenation, Balloc) print and _exit() the worker instead of a zend_error() longjmp() out of a half-initialized request; state that an error before the next request startup can reach is reset (user error and exception handler stacks, error handling mode, exception, the autoload guard table, freed $_GET/$_POST/... pointers, SAPI request strings, modules_activated, zend_llist head and tail); multipart parsing keeps only Content-Disposition and Content-Type headers, without duplicates; session upload progress stays off whatever session.upload_progress.enabled says. The code of that pull request as it is, so that sync skips this patch once the branch has it; what the official fix and the other 5.6 ports have on top is in backport-php2shell-2-extra.patch. Origin: remicollet/php-src-security#32 (RalphJS, 22.10.2026), commit 477c04a64, port of php-src 802c210 (PHP 7.4, Arnaud Le Blanc) to PHP-5.6-security-backports-openssl11 @ 5c2cc46; the same code as our own port of 22.10.2026 (5d7c52e), which it replaces. Skipped by sync once the branch has it - backport-php2shell-2-extra.patch: CVE-2026-109618 and CVE-2026-109619 for PHP 5.6, on top of backport-php2shell-1.patch: what the official fix and the other 5.6 ports have and that patch has not. $_GET, $_POST, $_COOKIE and their sub-arrays start as the smallest array (2 buckets: nTableMask 0 marks an uninitialized table in PHP 5), as the singleton arrays of the official fix; EG(error_handling) and EG(exception) are reset right after the object store is freed, where the official fix does it, so that an error in the rest of the shutdown cannot reach the freed exception; EG(exception_class) is reset with the handlers; SG(callback_func), the header callback of the request, is reset after it; "Out of memory" of the persistent allocator wrappers ends with _exit() instead of exit(), so that no atexit handler runs in that state. Origin: azsupport, from our port of 22.10.2026 (5d7c52e): the singleton arrays and the early reset from php-src 802c210 (PHP 7.4, Arnaud Le Blanc), SG(callback_func) from the 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch) - backport-soap-qname.patch: GHSA-453j-q27h-5p8x (CVE-2025-6491): serialize_zval() of ext/soap checks for a NULL node and a NULL node name before comparing the name with "BOGUS". libxml2 before 2.13 leaves the name NULL when it is longer than 2 GB; PHP 5 strings cannot be that long, and the upstream test needs one, so it is not carried. Origin: php-src commit c13a3b2 (03.06.2025, Ahmed Lekssays) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports) - backport-soap-ref-map.patch: GHSA-85c2-q967-79q5 (CVE-2026-6722): while SoapServer and SoapClient decode a message, the map of the objects that an href can point to holds a reference to each of them, so that an object freed while decoding (an apache:Map item replaced by a later item with the same key) is no longer used by a later href (use after free). PHP 5 counts references on the zval itself, so the result of a SoapClient call is taken over without freeing a zval that the map still holds; an object reached through an href is no longer a PHP reference (var_dump() shows no &), as in PHP 7. Origin: port of php-src commit 6c4b67c (03.05.2026, Ilija Tovilo) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with its test; the SoapClient test is ours - backport-soap.patch: GHSA-rgrp-mwpx-f6rm: unbounded recursion in ext/soap: a deeply nested WSDL or SOAP message, or a chain or loop of href references, no longer overflows the stack (iterative cleanup and search, at most 2048 levels of XML with libxml2 older than 2.13, at most 4096 levels of decoding: "Encoding: Nesting level too deep"); GHSA-cj93-vc83-wgqv: the HTTP reader of SoapClient keeps the chunk sizes and the body length within bounds (unsigned sizes, explicit limits instead of a signed overflow check). Origin: php-src commits 0a51c0d (17.09.2026, Alexandre Daubois) and 9b8abad (13.09.2026, Nora Dossche, Jakub Zelenka) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports), with the test of 0c5cff7; the limits follow the int body length of 5.6 - backport-unsigned-char-ctype.patch: GHSA-m8rr-4c36-8gq4 (CVE-2026-7258): every char handed to a ctype.h function (isalpha(), isdigit(), isspace(), tolower(), toupper() and the others) is cast to unsigned char: a byte of 0x80 and above made a negative argument, which the C standard leaves undefined and some C libraries use as an index before their table (FreeBSD and glibc check or allow it). The places of 7.4 that 5.6 does not have are left out. Origin: port of php-src commits b44c4c8 (03.05.2026, Ilija Tovilo) and 2c4b0c4 (25.10.2026: the -d value check of the CLI, CGI, FPM and phpdbg SAPIs) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports); in 5.6 also in ext/gd/libgd/xbm.c (gd_xbm.c in 7.4) and in the files that re2c made from the changed .re files - backport-xml-toffset-test.patch: GHSA-wg4p-4hqh-c3g9 (a recurrence of bug #72714 in xml_parse_into_struct() with XML_OPTION_SKIP_TAGSTART): the test only; 5.6 is not affected, as it passes the tag name to _xml_add_to_info() through SKIP_TAGSTART(), which bounds the offset. Origin: the test of php-src commit c5e836c (18.12.2024, Niels Dossche) of the PHP 7.4 security branch of Remi Collet (remicollet/php-src-security PHP-7.4-security-backports)
32 tests to test the new functionality and edge cases
Updates to the Reflection extension to expose access to the accessors
Tests for the changes to the Reflection extension
Implementation notes tracked here:
https://wiki.php.net/rfc/propertygetsetsyntax-as-implemented