Skip to content

Fix leak on double DatePeriod::__construct() call - #22643

Closed
iluuu1994 wants to merge 1 commit into
php:PHP-8.4from
iluuu1994:dateperiod-double-constructor-leak
Closed

iluuu1994 wants to merge 1 commit into
php:PHP-8.4from
iluuu1994:dateperiod-double-constructor-leak

Conversation

@iluuu1994

@iluuu1994 iluuu1994 commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

See https://github.com/php/php-src/actions/runs/28911263674/job/85769105449.

Normally we might want to discuss whether such code is even sensible, but it seems carbon is relying on it, as evidenced by the CI failure above. A minimal carbon example that reproduces the error:

<?php

use Carbon\Carbon;

require __DIR__ . '/vendor/autoload.php';

$day = Carbon::now();
$period = Carbon::now()->toPeriod($day);

Just remembered, will have to rebase onto 8.2 to keep nightly green.

@iluuu1994
iluuu1994 requested a review from derickr as a code owner July 8, 2026 17:21
@iluuu1994
iluuu1994 requested a review from TimWolla July 8, 2026 17:21

@TimWolla TimWolla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just looked at the diff, didn't check for completeness. I trust you there.

Comment thread ext/date/php_date.c Resolved
@iluuu1994

Copy link
Copy Markdown
Member Author

@kylekatarnls I hope it's ok to ping you directly. Just wanted to check with you whether the double constructor call is even intentional. This issue popped up recently in our CI, so I figured it might not be.

@kylekatarnls

kylekatarnls commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Hello, indeed I got this change submitted to us recently: CarbonPHP/carbon@9227630

And merged it, as you can read from the description, the goal is to update the native properties when the period get modified and __construct can actually do it in PHP 8.5.

We're considering CarbonPeriod mutable and have CarbonPeriodImmutable as an immutable version, DatePeriod becoming immutable (since 8.0 IIRC) made CarbonPeriod properties no longer compatible with the parent.

So I guess since the construct is skipped, the effect of the change above will be lost. At some point, we might have to drop mutable objects all at once at a certain PHP version.

@iluuu1994

Copy link
Copy Markdown
Member Author

@kylekatarnls Thank you for the explanation.

So I guess since the construct is skipped, the effect of the change above will be lost. At some point, we might have to drop mutable objects all at once at a certain PHP version.

Clarification: This PR fixes the leak, but does not change behavior (in the regular case at least, when the constructor call succeeds). So your fix should keep working.

@iluuu1994 iluuu1994 closed this in 2d86f8c Jul 15, 2026
azsupport added a commit to azsupport/php-src that referenced this pull request Oct 22, 2026
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-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.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: 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, freed $_GET/$_POST/... pointers, SAPI request strings and header callback, modules_activated, the autoload guard table, 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. $_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, so that request variables cost as little memory as they can. Left out, as PHP 5 has no counterpart: HT_HASH_RESET of the PHP 7 hash tables; the CONCAT overflow checks of the PHP 7 VM are those of concat_function() here. Cross-checked with the independent 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch), which brought the singleton arrays, the reset of SG(callback_func) and the earlier reset of EG(error_handling) and EG(exception), and with the one of vperetti/php-cve-2026-109618-109619-backports (patches/php-5.6-CVE-2026-109618-109619.patch), which brought the reset of EG(in_autoload).
  Origin: azsupport, port of php-src commit 802c210 (PHP 7.4, Arnaud Le Blanc, 18.10.2026, cherry-pick of b62095c75da7; GHSA-w8hw-w9fx-j79w, GHSA-6wmf-4rv5-p3rp) to remicollet PHP-5.6-security-backports-openssl11 @ 5c2cc46; replaces backport-oom-exit.patch. Drop when that branch gets its own fix
- 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
azsupport added a commit to azsupport/php-src that referenced this pull request Oct 22, 2026
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.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: 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, freed $_GET/$_POST/... pointers, SAPI request strings and header callback, modules_activated, the autoload guard table, 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. $_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, so that request variables cost as little memory as they can. Left out, as PHP 5 has no counterpart: HT_HASH_RESET of the PHP 7 hash tables; the CONCAT overflow checks of the PHP 7 VM are those of concat_function() here. Cross-checked with the independent 5.6 port of Ondrej Sury (php5.6 5.6.40-104, debian/patches/0261-Avoid-state-corruption-via-bailout.patch), which brought the singleton arrays, the reset of SG(callback_func) and the earlier reset of EG(error_handling) and EG(exception), and with the one of vperetti/php-cve-2026-109618-109619-backports (patches/php-5.6-CVE-2026-109618-109619.patch), which brought the reset of EG(in_autoload).
  Origin: azsupport, port of php-src commit 802c210 (PHP 7.4, Arnaud Le Blanc, 18.10.2026, cherry-pick of b62095c75da7; GHSA-w8hw-w9fx-j79w, GHSA-6wmf-4rv5-p3rp) to remicollet PHP-5.6-security-backports-openssl11 @ 5c2cc46; replaces backport-oom-exit.patch. Drop when that branch gets its own fix
- 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
azsupport added a commit to azsupport/php-src that referenced this pull request Oct 23, 2026
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
azsupport added a commit to azsupport/php-src that referenced this pull request Oct 23, 2026
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
azsupport added a commit to azsupport/php-src that referenced this pull request Oct 23, 2026
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
azsupport added a commit to azsupport/php-src that referenced this pull request Oct 23, 2026
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
azsupport added a commit to azsupport/php-src that referenced this pull request Oct 23, 2026
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
azsupport added a commit to azsupport/php-src that referenced this pull request Oct 23, 2026
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
azsupport added a commit to azsupport/php-src that referenced this pull request Oct 26, 2026
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
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 4, 2026
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
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 4, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 4, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 8, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 9, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 9, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 9, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 10, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 10, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 11, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 11, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 12, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 12, 2026
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)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 13, 2026
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-disabled-class-properties.patch: a class in disable_classes: new on it gave an object without the table of its declared properties, and reading one of them crashed the process ($o = new CURLFile; $o->name; bug #77494); the table is made, empty, now. Only where php.ini of 5.6 has disable_classes
  Origin: php-src commit 73f222d (Dmitry Stogov, 24.01.2019, PHP 7.2.15), as Gentoo carries it for 5.6 (proj/php-patches, branch php5.6, 00100_bug77494.patch), with its test
- backport-dns-empty-record.patch: CVE-2019-9022 (bug #77369): dns_get_record() took a DNS record with no data (its length 0) and read on with a negative length, a memcpy() past the buffer of the answer; such a record is skipped now. It needs a hostile DNS server or a forged answer
  Origin: php-src commit 8d3dfab (Stanislav Malyshev, 29.12.2018, PHP 7.1.26; in Remi Collet's 7.4 branch), as Debian carries it for 5.6 (php5 5.6.40+dfsg-0+deb8u12 of jessie LTS and its ELTS, debian/patches/CVE-2019-9022.patch)
- backport-dns-res-ndestroy.patch: dns_get_record(), checkdnsrr() and getmxrr() leaked, on every call, the memory res_ninit() of the libc of FreeBSD allocates for the state of the resolver: php_dns.h of 5.6 ends that state with res_nclose(), which leaves it, and only res_ndestroy() frees it. Memory of the libc, outside memory_limit: a php-fpm worker or an Apache child grew until it was recycled. res_ndestroy() where the libc has it (a configure check), as PHP 7 does
  Origin: ext/standard/php_dns.h and config.m4 of PHP 7 (HAVE_RES_NDESTROY; Remi Collet's 7.4 branch, which our 7.4 to 8.4 have), the leak as pkgsrc fixes it for lang/php56 (patches/patch-ext_standard_php__dns.h: res_ndestroy() but on glibc)
- backport-fileinfo-libmagic.patch: the libmagic 5.17 bundled in ext/fileinfo (finfo_file(), finfo_buffer(), mime_content_type() on uploaded files): the number of elements of a CDF vector (Office documents) without a limit (CVE-2019-18218: no overflow in the copy of PHP, but memory without a bound), and the fixes of file 5.30 and 5.31 for crafted files found by OSS-Fuzz: a read past the buffer when comparing with compacted whitespace (softmagic.c), PR/599, a read past the end of a CDF string vector, is_tar() rewritten without signed counters and a strcmp() of an unterminated field, the property info of a bad CDF freed and its pointer cleared on the error (a double free of its callers), a field that could not be read set to 0, the sectors of a CDF limited further
  Origin: Debian php5 5.6.40+dfsg-0+deb8u12 (jessie LTS and its ELTS), debian/patches/not-cve-but-bug-CVE-2019-18218.patch (the limit of file 5.38, Christos Zoulas, PHP 7.2.24); file commits FILE5_30-12-g77a7041f, FILE5_30-18-g4e4e7609, FILE5_30-19-g7605984c, FILE5_30-30-gc703aa9f, FILE5_30-38-gfd42e119, FILE5_30-39-geb973428 (Christos Zoulas, March and April 2017), as Debian carries them on file 5.30 (1:5.30-1+deb9u3, stretch LTS and its ELTS), the paths src/ as ext/fileinfo/libmagic/ and the free of the error path of cdf_read_property_info() on the code of 5.17, which frees there already
- 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-free-result.patch: mysqlnd: $stmt->free_result() of a prepared statement after the connection was closed set the state of the closed connection back to ready, and the $stmt->close() after it crashed the process (bug #69899); the state is kept when the connection is closed now
  Origin: php-src commit bd75f9e (Richard Fussenegger, 30.09.2016, PHP 7.0.13; in Remi Collet's 7.4 branch), as Debian carries it for 5.6 (php5 5.6.40+dfsg-0+deb8u22, debian/patches/0118-Fix-bug-69899.patch), with its test
- 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-openssl3-unexpected-eof.patch: OpenSSL 3 (that of the base system of FreeBSD 15) takes a TLS peer that closes the connection without close_notify for an attack on the end of the data: "SSL: ... unexpected eof while reading", a warning and a failed read in https://, ssl://, tls:// streams and SoapClient, where OpenSSL 1.1.1 gave the end of the data (bug #79589, phpGH-8369; many servers close so); SSL_OP_IGNORE_UNEXPECTED_EOF keeps the behaviour of OpenSSL 1.1.1, as PHP 8.1 and later do
  Origin: php-src commit 74f75db (Jakub Zelenka, 15.05.2022, PHP 8.1.7), as Ondřej Surý carries it for 5.6 (php5.6 5.6.40-105, debian/patches/0199-Fix-bug-79589-ssl3_read_n-unexpected-eof-while-readi.patch), without its whitespace changes; its test with the SKIPIF of 5.6 (an online test, skipped with SKIP_ONLINE_TESTS)
- 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-libxml213-entities.patch: ext/xml with libxml2 2.13 and later (that of az is 2.15): _get_entity() of compat.c waited for parser states that libxml2 2.13 no longer sets, so the entities in attribute and entity values went to the default handler as text, data that is not in the document (<a hint="x&apos;y"> gave an extra ' to the character data handler; phpGH-14834, PEAR could not read its package.xml): only in the content of elements now
  Origin: php-src commit 67259e4 (Niels Dossche, 05.07.2024, PHP 8.2.22), as pkgsrc carries it for lang/php56 (patches/patch-ext_xml_compat.c) and MacPorts for php74, with its test (the SKIPIF of 5.6)
- 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)
- backport-zip-empty-file.patch: ZipArchive::open() of an existing empty file (one of tempnam(), say) without ZipArchive::OVERWRITE failed with "Not a zip archive" with libzip 1.6.0 and later, which no longer take an empty file for an empty archive (bug #79296): the modules of 5.6 are built with the libzip of az (1.12); such a file is opened as with ZipArchive::OVERWRITE now, as PHP 7.3 and later do. Nothing changes with the libzip bundled in PHP (0.11)
  Origin: php-src commit 8aab43c (Remi Collet, 19.03.2020, PHP 7.3.17), as Ondřej Surý carries it for 5.6 (php5.6 5.6.40-105, debian/patches/0146-Fix-Bug-79296-ZipArchive-open-fails-on-empty-file.patch); the version of libzip checked when building (that of az, linked dynamically)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 13, 2026
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-disabled-class-properties.patch: a class in disable_classes: new on it gave an object without the table of its declared properties, and reading one of them crashed the process ($o = new CURLFile; $o->name; bug #77494); the table is made, empty, now. Only where php.ini of 5.6 has disable_classes
  Origin: php-src commit 73f222d (Dmitry Stogov, 24.01.2019, PHP 7.2.15), as Gentoo carries it for 5.6 (proj/php-patches, branch php5.6, 00100_bug77494.patch), with its test
- backport-dns-empty-record.patch: CVE-2019-9022 (bug #77369): dns_get_record() took a DNS record with no data (its length 0) and read on with a negative length, a memcpy() past the buffer of the answer; such a record is skipped now. It needs a hostile DNS server or a forged answer
  Origin: php-src commit 8d3dfab (Stanislav Malyshev, 29.12.2018, PHP 7.1.26; in Remi Collet's 7.4 branch), as Debian carries it for 5.6 (php5 5.6.40+dfsg-0+deb8u12 of jessie LTS and its ELTS, debian/patches/CVE-2019-9022.patch)
- backport-dns-res-ndestroy.patch: dns_get_record(), checkdnsrr() and getmxrr() leaked, on every call, the memory res_ninit() of the libc of FreeBSD allocates for the state of the resolver: php_dns.h of 5.6 ends that state with res_nclose(), which leaves it, and only res_ndestroy() frees it. Memory of the libc, outside memory_limit: a php-fpm worker or an Apache child grew until it was recycled. res_ndestroy() where the libc has it (a configure check), as PHP 7 does
  Origin: ext/standard/php_dns.h and config.m4 of PHP 7 (HAVE_RES_NDESTROY; Remi Collet's 7.4 branch, which our 7.4 to 8.4 have), the leak as pkgsrc fixes it for lang/php56 (patches/patch-ext_standard_php__dns.h: res_ndestroy() but on glibc)
- backport-fileinfo-libmagic.patch: the libmagic 5.17 bundled in ext/fileinfo (finfo_file(), finfo_buffer(), mime_content_type() on uploaded files): the number of elements of a CDF vector (Office documents) without a limit (CVE-2019-18218: no overflow in the copy of PHP, but memory without a bound), and the fixes of file 5.30 and 5.31 for crafted files found by OSS-Fuzz: a read past the buffer when comparing with compacted whitespace (softmagic.c), PR/599, a read past the end of a CDF string vector, is_tar() rewritten without signed counters and a strcmp() of an unterminated field, the property info of a bad CDF freed and its pointer cleared on the error (a double free of its callers), a field that could not be read set to 0, the sectors of a CDF limited further
  Origin: Debian php5 5.6.40+dfsg-0+deb8u12 (jessie LTS and its ELTS), debian/patches/not-cve-but-bug-CVE-2019-18218.patch (the limit of file 5.38, Christos Zoulas, PHP 7.2.24); file commits FILE5_30-12-g77a7041f, FILE5_30-18-g4e4e7609, FILE5_30-19-g7605984c, FILE5_30-30-gc703aa9f, FILE5_30-38-gfd42e119, FILE5_30-39-geb973428 (Christos Zoulas, March and April 2017), as Debian carries them on file 5.30 (1:5.30-1+deb9u3, stretch LTS and its ELTS), the paths src/ as ext/fileinfo/libmagic/ and the free of the error path of cdf_read_property_info() on the code of 5.17, which frees there already
- 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-free-result.patch: mysqlnd: $stmt->free_result() of a prepared statement after the connection was closed set the state of the closed connection back to ready, and the $stmt->close() after it crashed the process (bug #69899); the state is kept when the connection is closed now
  Origin: php-src commit bd75f9e (Richard Fussenegger, 30.09.2016, PHP 7.0.13; in Remi Collet's 7.4 branch), as Debian carries it for 5.6 (php5 5.6.40+dfsg-0+deb8u22, debian/patches/0118-Fix-bug-69899.patch), with its test
- 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-openssl3-unexpected-eof.patch: OpenSSL 3 (that of the base system of FreeBSD 15) takes a TLS peer that closes the connection without close_notify for an attack on the end of the data: "SSL: ... unexpected eof while reading", a warning and a failed read in https://, ssl://, tls:// streams and SoapClient, where OpenSSL 1.1.1 gave the end of the data (bug #79589, phpGH-8369; many servers close so); SSL_OP_IGNORE_UNEXPECTED_EOF keeps the behaviour of OpenSSL 1.1.1, as PHP 8.1 and later do
  Origin: php-src commit 74f75db (Jakub Zelenka, 15.05.2022, PHP 8.1.7), as Ondřej Surý carries it for 5.6 (php5.6 5.6.40-105, debian/patches/0199-Fix-bug-79589-ssl3_read_n-unexpected-eof-while-readi.patch), without its whitespace changes; its test with the SKIPIF of 5.6 (an online test, skipped with SKIP_ONLINE_TESTS)
- 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-libxml213-entities.patch: ext/xml with libxml2 2.13 and later (that of az is 2.15): _get_entity() of compat.c waited for parser states that libxml2 2.13 no longer sets, so the entities in attribute and entity values went to the default handler as text, data that is not in the document (<a hint="x&apos;y"> gave an extra ' to the character data handler; phpGH-14834, PEAR could not read its package.xml): only in the content of elements now
  Origin: php-src commit 67259e4 (Niels Dossche, 05.07.2024, PHP 8.2.22), as pkgsrc carries it for lang/php56 (patches/patch-ext_xml_compat.c) and MacPorts for php74, with its test (the SKIPIF of 5.6)
- 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)
- backport-zip-empty-file.patch: ZipArchive::open() of an existing empty file (one of tempnam(), say) without ZipArchive::OVERWRITE failed with "Not a zip archive" with libzip 1.6.0 and later, which no longer take an empty file for an empty archive (bug #79296): the modules of 5.6 are built with the libzip of az (1.12); such a file is opened as with ZipArchive::OVERWRITE now, as PHP 7.3 and later do. Nothing changes with the libzip bundled in PHP (0.11)
  Origin: php-src commit 8aab43c (Remi Collet, 19.03.2020, PHP 7.3.17), as Ondřej Surý carries it for 5.6 (php5.6 5.6.40-105, debian/patches/0146-Fix-Bug-79296-ZipArchive-open-fails-on-empty-file.patch); the version of libzip checked when building (that of az, linked dynamically)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 16, 2026
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-disabled-class-properties.patch: a class in disable_classes: new on it gave an object without the table of its declared properties, and reading one of them crashed the process ($o = new CURLFile; $o->name; bug #77494); the table is made, empty, now. Only where php.ini of 5.6 has disable_classes
  Origin: php-src commit 73f222d (Dmitry Stogov, 24.01.2019, PHP 7.2.15), as Gentoo carries it for 5.6 (proj/php-patches, branch php5.6, 00100_bug77494.patch), with its test
- backport-dns-empty-record.patch: CVE-2019-9022 (bug #77369): dns_get_record() took a DNS record with no data (its length 0) and read on with a negative length, a memcpy() past the buffer of the answer; such a record is skipped now. It needs a hostile DNS server or a forged answer
  Origin: php-src commit 8d3dfab (Stanislav Malyshev, 29.12.2018, PHP 7.1.26; in Remi Collet's 7.4 branch), as Debian carries it for 5.6 (php5 5.6.40+dfsg-0+deb8u12 of jessie LTS and its ELTS, debian/patches/CVE-2019-9022.patch)
- backport-dns-res-ndestroy.patch: dns_get_record(), checkdnsrr() and getmxrr() leaked, on every call, the memory res_ninit() of the libc of FreeBSD allocates for the state of the resolver: php_dns.h of 5.6 ends that state with res_nclose(), which leaves it, and only res_ndestroy() frees it. Memory of the libc, outside memory_limit: a php-fpm worker or an Apache child grew until it was recycled. res_ndestroy() where the libc has it (a configure check), as PHP 7 does
  Origin: ext/standard/php_dns.h and config.m4 of PHP 7 (HAVE_RES_NDESTROY; Remi Collet's 7.4 branch, which our 7.4 to 8.4 have), the leak as pkgsrc fixes it for lang/php56 (patches/patch-ext_standard_php__dns.h: res_ndestroy() but on glibc)
- backport-fileinfo-libmagic.patch: the libmagic 5.17 bundled in ext/fileinfo (finfo_file(), finfo_buffer(), mime_content_type() on uploaded files): the number of elements of a CDF vector (Office documents) without a limit (CVE-2019-18218: no overflow in the copy of PHP, but memory without a bound), and the fixes of file 5.30 and 5.31 for crafted files found by OSS-Fuzz: a read past the buffer when comparing with compacted whitespace (softmagic.c), PR/599, a read past the end of a CDF string vector, is_tar() rewritten without signed counters and a strcmp() of an unterminated field, the property info of a bad CDF freed and its pointer cleared on the error (a double free of its callers), a field that could not be read set to 0, the sectors of a CDF limited further
  Origin: Debian php5 5.6.40+dfsg-0+deb8u12 (jessie LTS and its ELTS), debian/patches/not-cve-but-bug-CVE-2019-18218.patch (the limit of file 5.38, Christos Zoulas, PHP 7.2.24); file commits FILE5_30-12-g77a7041f, FILE5_30-18-g4e4e7609, FILE5_30-19-g7605984c, FILE5_30-30-gc703aa9f, FILE5_30-38-gfd42e119, FILE5_30-39-geb973428 (Christos Zoulas, March and April 2017), as Debian carries them on file 5.30 (1:5.30-1+deb9u3, stretch LTS and its ELTS), the paths src/ as ext/fileinfo/libmagic/ and the free of the error path of cdf_read_property_info() on the code of 5.17, which frees there already
- 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-free-result.patch: mysqlnd: $stmt->free_result() of a prepared statement after the connection was closed set the state of the closed connection back to ready, and the $stmt->close() after it crashed the process (bug #69899); the state is kept when the connection is closed now
  Origin: php-src commit bd75f9e (Richard Fussenegger, 30.09.2016, PHP 7.0.13; in Remi Collet's 7.4 branch), as Debian carries it for 5.6 (php5 5.6.40+dfsg-0+deb8u22, debian/patches/0118-Fix-bug-69899.patch), with its test
- 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-openssl3-unexpected-eof.patch: OpenSSL 3 (that of the base system of FreeBSD 15) takes a TLS peer that closes the connection without close_notify for an attack on the end of the data: "SSL: ... unexpected eof while reading", a warning and a failed read in https://, ssl://, tls:// streams and SoapClient, where OpenSSL 1.1.1 gave the end of the data (bug #79589, phpGH-8369; many servers close so); SSL_OP_IGNORE_UNEXPECTED_EOF keeps the behaviour of OpenSSL 1.1.1, as PHP 8.1 and later do
  Origin: php-src commit 74f75db (Jakub Zelenka, 15.05.2022, PHP 8.1.7), as Ondřej Surý carries it for 5.6 (php5.6 5.6.40-105, debian/patches/0199-Fix-bug-79589-ssl3_read_n-unexpected-eof-while-readi.patch), without its whitespace changes; its test with the SKIPIF of 5.6 (an online test, skipped with SKIP_ONLINE_TESTS)
- 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-libxml213-entities.patch: ext/xml with libxml2 2.13 and later (that of az is 2.15): _get_entity() of compat.c waited for parser states that libxml2 2.13 no longer sets, so the entities in attribute and entity values went to the default handler as text, data that is not in the document (<a hint="x&apos;y"> gave an extra ' to the character data handler; phpGH-14834, PEAR could not read its package.xml): only in the content of elements now
  Origin: php-src commit 67259e4 (Niels Dossche, 05.07.2024, PHP 8.2.22), as pkgsrc carries it for lang/php56 (patches/patch-ext_xml_compat.c) and MacPorts for php74, with its test (the SKIPIF of 5.6)
- 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)
- backport-zip-empty-file.patch: ZipArchive::open() of an existing empty file (one of tempnam(), say) without ZipArchive::OVERWRITE failed with "Not a zip archive" with libzip 1.6.0 and later, which no longer take an empty file for an empty archive (bug #79296): the modules of 5.6 are built with the libzip of az (1.12); such a file is opened as with ZipArchive::OVERWRITE now, as PHP 7.3 and later do. Nothing changes with the libzip bundled in PHP (0.11)
  Origin: php-src commit 8aab43c (Remi Collet, 19.03.2020, PHP 7.3.17), as Ondřej Surý carries it for 5.6 (php5.6 5.6.40-105, debian/patches/0146-Fix-Bug-79296-ZipArchive-open-fails-on-empty-file.patch); the version of libzip checked when building (that of az, linked dynamically)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants