Skip to content

ext/zip: fix use-after-free in the archive destructor path - #23779

Closed
jvoisin wants to merge 2 commits into
php:masterfrom
jvoisin:uaf
Closed

jvoisin wants to merge 2 commits into
php:masterfrom
jvoisin:uaf

Conversation

@jvoisin

@jvoisin jvoisin commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Commit 132403d guarded php_zipobj_close() and ZipArchive::open() with the archive->close flag so that a progress or cancel callback firing during zip_close() cannot re-enter and run a nested zip_close() followed by zip_discard(), which frees the archive still in use.

php_zip_archive_release() was left unguarded. php_zipobj_close() sets archive->za = NULL before calling release(), so the close() path is safe, but when a ZipArchive is destroyed without an explicit close() the archive is finalized here with za still set. The progress/cancel callback fires during that zip_close(), and a re-entrant close() or open() then nests zip_close() on the same archive, causing the same use-after-free.

Set archive->close around the release-path zip_close() as well, so the re-entrant call throws "Already being closed" instead of nesting.

Commit 132403d guarded php_zipobj_close() and ZipArchive::open()
with the archive->close flag so that a progress or cancel callback
firing during zip_close() cannot re-enter and run a nested zip_close()
followed by zip_discard(), which frees the archive still in use.

php_zip_archive_release() was left unguarded. php_zipobj_close() sets
archive->za = NULL before calling release(), so the close() path is
safe, but when a ZipArchive is destroyed without an explicit close()
the archive is finalized here with za still set. The progress/cancel
callback fires during that zip_close(), and a re-entrant close() or
open() then nests zip_close() on the same archive, causing the same
use-after-free.

Set archive->close around the release-path zip_close() as well, so the
re-entrant call throws "Already being closed" instead of nesting.
@devnexen

Copy link
Copy Markdown
Member

suggestion (does not have to be in the same PR, but since the goal is to "plug" cases where the zip stream close):

  • protecting the getStream() case that can still reach the assert (I think adding php_zipobj_closing check is enough).
  • guarding php_zip_progress_callback_free like php_zip_progress_callback does ?

Other than that, the fix itself here is correct from my POV.

@jvoisin

jvoisin commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

suggestion (does not have to be in the same PR, but since the goal is to "plug" cases where the zip stream close):

* protecting the getStream() case that can still reach the assert (I think adding php_zipobj_closing check is enough).

* guarding php_zip_progress_callback_free like php_zip_progress_callback does ?

Other than that, the fix itself here is correct from my POV.

Yeah, good points, I piled a commit doing this on top of the initial one

@devnexen

Copy link
Copy Markdown
Member

Could these tests be added ?

this one, normally should pass with your branch

--TEST--
GH-23747 (re-entrant close()/getStream() from a callback fired by the ZipArchive destructor)
--EXTENSIONS--
zip
--SKIPIF--
<?php
if (!method_exists(ZipArchive::class, 'registerProgressCallback')) {
    die('skip progress callbacks are not supported');
}
?>
--FILE--
<?php
function populate(ZipArchive $zip, string $filename): void {
    $zip->open($filename, ZipArchive::CREATE | ZipArchive::OVERWRITE);
    for ($i = 0; $i < 64; $i++) {
        $zip->addFromString("f$i.txt", str_repeat('x', 2000));
    }
}

$filename = __DIR__ . '/gh23747_dtor.zip';

$zip = new ZipArchive();
populate($zip, $filename);
$weak = WeakReference::create($zip);
$zip->registerProgressCallback(0.0, function ($rate) use ($weak) {
    static $done = false;
    if ($done) {
        return;
    }
    $done = true;
    try {
        $weak->get()->close();
    } catch (Error $e) {
        echo $e::class, ': ', $e->getMessage(), PHP_EOL;
    }
});
unset($zip);
echo 'destroyed', PHP_EOL;

$zip = new ZipArchive();
populate($zip, $filename);
$weak = WeakReference::create($zip);
$zip->registerProgressCallback(0.0, function ($rate) use ($weak) {
    static $done = false;
    if ($done) {
        return;
    }
    $done = true;
    try {
        $weak->get()->getStreamName('f0.txt');
    } catch (Error $e) {
        echo $e::class, ': ', $e->getMessage(), PHP_EOL;
    }
});
unset($zip);
echo 'destroyed', PHP_EOL;
?>
--CLEAN--
<?php
@unlink(__DIR__ . '/gh23747_dtor.zip');
?>
--EXPECT--
Error: Already being closed
destroyed
Error: Already being closed
destroyed

however, not sure about this one

$dir = __DIR__ . '/zdir'; @mkdir($dir);
$zip = new ZipArchive();
$zip->open($dir . '/t.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
for ($i = 0; $i < 8; $i++) { $zip->addFromString("f$i.txt", str_repeat('x', 200)); }
set_error_handler(function ($no, $str) use ($zip) {
    static $done = false;
    if ($done) { return true; }
    $done = true;
    try { var_dump($zip->close()); }
    catch (Error $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; }
    return true;
});
chmod($dir, 0555);
var_dump($zip->close());

…t close

Follow-up to the archive destructor use-after-free fix, plugging two more
paths where a progress or cancel callback firing during zip_close() can
re-enter the archive.

getStream() reached php_zip_archive_addref() with the archive already being
closed (refcount 0), tripping the ZEND_ASSERT(refcount > 0). Guard it with
php_zipobj_closing() so the call throws "Already being closed" instead.

Guard php_zip_progress_callback_free() and php_zip_cancel_callback_free()
like their callback counterparts, so the FCC destructor is not run while the
engine is inactive or in a bailout.
@jvoisin

jvoisin commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for taking the time to write the tests, I should have been the one doing it in the first place :/

@devnexen

Copy link
Copy Markdown
Member

One last thing I did not notice, target branch should be PHP-8.4. CI should be green so LGTM but I ll let Weilin handles the matter.

@jvoisin

jvoisin commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

One last thing I did not notice, target branch should be PHP-8.4. CI should be green so LGTM but I ll let Weilin handles the matter.

Why should it target 8.4?

@LamentXU123

Copy link
Copy Markdown
Member

Because this is a bugfix. And our lowest bugfix support minor version is 8.4 :)

@jvoisin

jvoisin commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

The other PR I sent recently to address heap corruptions (#23818, #23814, #23771, #23770, …) were all against the master branch, and were merged there :/

@LamentXU123

Copy link
Copy Markdown
Member

I think they were wrongly merged. I will take care of backporting them :)

@LamentXU123 LamentXU123 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.

LGTM. Nice work!
Last thing, please rebase this to 8.4. I've talked to other people about your previous fixes about whether they should be backport and we'll see. At least it is nice to have this patch in stable branches. Thank you.

Update: They are backported.

LamentXU123 added a commit that referenced this pull request Oct 8, 2026
* PHP-8.6:
  ext/zip: Fix use-after-free in the archive destructor path (#23779)
@LamentXU123

Copy link
Copy Markdown
Member

Thank you!

Ti-Mis pushed a commit to Ti-Mis/php-src that referenced this pull request Oct 8, 2026
* PHP-8.4:
  ext/zip: Fix use-after-free in the archive destructor path (php#23779)
Ti-Mis pushed a commit to Ti-Mis/php-src that referenced this pull request Oct 8, 2026
* PHP-8.5:
  ext/zip: Fix use-after-free in the archive destructor path (php#23779)
damek24 pushed a commit to damek24/php-src that referenced this pull request Oct 8, 2026
A progress or cancel callback runs inside zip_close() after libzip has
fixed the list of entries it writes. Deleting or unchanging an entry from
the callback frees a dirent that zip_close() still uses. Other changes are
either silently dropped or make close() fail and lose the archive.

Reject archive mutations with the same "Already being closed" Error that
close() and open() already raise, using php_zipobj_closing(). This follows
phpGH-23749 and complements the destructor protection in phpGH-23779.

Cover progress callbacks, cancel callbacks, and the implicit close() in
open(), and verify that the archive contents are preserved.

Closes php#24025
arnaud-lb added a commit to frodeborli/php-src that referenced this pull request Oct 9, 2026
* up/master: (180 commits)
  Changed the test expected result of `pdo_mysql/bug76815_pdo_mysql_f to %d (php#13808)
  ext/standard: name the real parameter in the unpack() offset error (php#24215)
  ext/readline: Refactor CLI readline completion generators
  Fix phpGH-24081: User opcode DISPATCH runs on a stale frame in the TAILCALL VM
  ext/standard: Validate the bcrypt cost before reading it
  JIT: Avoid object type check if the object is known to be a type (php#24086)
  zend_alloc: move a small block shrunk to the size of the bin below
  Fix phpGH-23979: Nullsafe operator must not flush delayed oplines of an enclosing function
  ext/zip: Reject ZipArchive mutators during close() (php#24025)
  Fix OSS-Fuzz #568005340: FETCH_DIM_FUNC_ARG partial conversion
  Fix too wide type inference for ASSIGN_DIM_OP
  Fix type inference of ADD_ARRAY_UNPACK with integer keys
  Evaluate ZEND_SPACESHIP in SCCP
  Add range inference for SPACESHIP
  JIT: Optimize array checks in comparisons (php#24084)
  Fix leak when the added previous exception is already in the chain (php#24177)
  date: Add `php_date_time_duration_create()` in a new `time_duration.h` (php#24072)
  ext/zip: Fix use-after-free in the archive destructor path (php#23779)
  ext/standard: Optimize array_chunk() by filling packed chunks directly
  Fix phpGH-17626: JIT corrupts opline handler when blacklisting root trace
  ...
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 20, 2026
The zip fixes of PHP-8.4 since June 2026 that 8.2.36 and 8.3.37 lack,
one backport each, with their tests: the use-after-frees of close() and
of the destructor from a progress or cancel callback and of the
mutators during close() (phpGH-23747, phpGH-23779, phpGH-24025), of an inherited
entry comment (phpGH-22649), the stream that outlived its archive
(phpGH-17787, with the refcounted archive state of phpGH-23276), read errors
and CRC errors taken for success (phpGH-23240), the defaults of addGlob()
and addPattern() (on 8.2 an uninitialized zip_options without options),
FL_UNCHANGED of getFromIndex(), fstat() of an archive that cannot be
opened, the index of getNameIndex(), extractTo() with a non-list array,
the AES lines of phpinfo() and three error-path leaks. 8.3 takes them as
they are; 8.2 has no ZIP_FL_OPEN_FILE_NOW path (01 not needed) and takes
five adapted. Built with --with-zip on both: the zip tests pass (8.3:
117, 8.2: 108; libzip 1.7.3).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 20, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-fpm-scoreboard-readers.patch: php-fpm: the status page and fpm_get_status() under load failed with "scoreboard: failed to lock (already locked)" while a worker updated the scoreboard, as readers and writers took one spin lock and a reader did not wait (phpGH-13437); a reader count and a writer flag now, the readers waiting for the writer and the writers for the readers, with a limit of retries for a crashed one
  Origin: php-src commit 3490ac0 (Jakub Zelenka, 07.09.2024, PHP 8.3.16), the commit of upstream that Ubuntu took in place of its first backport for 8.3.6 (noble, fix-fpm-scoreboard.patch, LP #2130569 and #2144556: the first one crashed php-fpm)
- backport-separate-live-range.patch: CVE-2024-11235 (GHSA-rwp7-7vc6-8477): the live range of the temporary that ZEND_SEPARATE defines again was ended there, which broke the handling of COPY_TMP: ??= on a property of the result of a call ($a->f()->p ??= ..., f()->p ??= ...), with __set or a typed property that throws, freed the value twice (a use-after-free). Fixed upstream in 8.3.19 and 8.4.5 only; the same code (zend_calc_live_ranges()) is in this branch
  Origin: php-src commit ef2c459 (Ilija Tovilo, 13.11.2024, PHP 8.3.19), with its three tests, as SUSE carries it for 7.4.33 and 8.0.30 (php7-CVE-2024-11235.patch, SLE 15) and Ubuntu for 7.4 (focal) and 8.1 (jammy) (CVE-2024-11235.patch)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); here zip_options was not initialized at all without an options array (remove_path and add_path read from the stack): the defaults are set at its declaration, the memset and defaults of php_zip_parse_options() of 8.2 dropped; its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); the n of php_zip_get_from() of 8.2 is an int: zip_int64_t now; its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); brought onto php_zip_add_file(), php_zip_add_from_pattern() and the callback registration of 8.2 by hand; its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); php_zip_extract_file() of 8.2 has no index argument; its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); the checks placed by hand as upstream, without setArchiveFlag() (8.3 and later), also in its test; its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 20, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-zip-01-add-file-fd-leak.patch: php_zip_add_file() leaked the file it had opened for ZIP_FL_OPEN_FILE_NOW when zip_source_filep() failed (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 4c54dce (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 21, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-fpm-scoreboard-readers.patch: php-fpm: the status page and fpm_get_status() under load failed with "scoreboard: failed to lock (already locked)" while a worker updated the scoreboard, as readers and writers took one spin lock and a reader did not wait (phpGH-13437); a reader count and a writer flag now, the readers waiting for the writer and the writers for the readers, with a limit of retries for a crashed one
  Origin: php-src commit 3490ac0 (Jakub Zelenka, 07.09.2024, PHP 8.3.16), the commit of upstream that Ubuntu took in place of its first backport for 8.3.6 (noble, fix-fpm-scoreboard.patch, LP #2130569 and #2144556: the first one crashed php-fpm)
- backport-gd-font-uninitialized.patch: gd: imagefontwidth(), imagefontheight(), imagestring(), imagestringup(), imagechar() and imagecharup() with a font of imageloadfont() (a GdFont object) left the integer of the font uninitialised, which the font of the object was looked up with too: undefined behaviour, a wrong font with clang 14 and later at -Os (phpGH-13082); both initialised now
  Origin: php-src commits 1e464e5 and df85c25 (Niels Dossche, 09.01.2024 and 13.01.2024, PHP 8.2.15), as MacPorts carries them for php81 (lang/php/files/patch-php81-ext-gd.diff); their test needs a binary font file, which a patch cannot carry: left out
- 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/php74 and lang/php81 (patches/patch-ext_xml_compat.c) and MacPorts for php74, with its test (the SKIPIF of 8.1)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); here zip_options was not initialized at all without an options array (remove_path and add_path read from the stack): the defaults are set at its declaration, the memset and defaults of php_zip_parse_options() dropped; its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); brought onto getStream() and php_stream_zip_open() of 8.1, which has no getStreamIndex() and getStreamName(); its test with getStream() only; its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); the n of php_zip_get_from() is an int here: zip_int64_t now; its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); brought onto php_zip_add_file(), php_zip_add_from_pattern(), the callback registration and the stream opener of 8.1 by hand (8.1 has no clearError()); its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); php_zip_extract_file() has no index argument here; its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); the guard of getStream() of 8.1; its test without getStreamIndex() and getStreamName(); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); the checks placed by hand as upstream, without setArchiveFlag() (8.3 and later), also in its test; its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
- backport-zip-17-gh21698-addglob-leak.patch: phpGH-21698: addGlob() did not free the glob() result when no file matched or open_basedir refused the match (PHP 8.4.21, not in this branch); with the array_init() of the no-match return here; its test expects NULL, which addGlob() returns here when open_basedir refuses the match; its tests taken
  Origin: php-src commit 391ec27 (David Carlier, 10.04.2026, PHP 8.4.21)
- backport-zz-GHSA-658j-r8rw-q6mx-runtime.patch: GHSA-658j-r8rw-q6mx (CVE-2026-115560, the PHP security release of 19.11.2026): the session settings not to be changed at run time while session.upload_progress.enabled is on (an Error, as PHP 8.2 and later), the part of the fix Remi Collet's backport leaves out ("Default change only"; his commit of the default off and the reset in GINIT is upstream of this branch), with its test
  Origin: php-src commit 3f70f66 (Arnaud Le Blanc, 09.11.2026, PHP 8.2.36): its SESSION_CHECK_UPLOAD_PROGRESS_STATE and the INI handlers it guards; on the decision of aZ, 19.11.2026
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 21, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-fpm-scoreboard-readers.patch: php-fpm: the status page and fpm_get_status() under load failed with "scoreboard: failed to lock (already locked)" while a worker updated the scoreboard, as readers and writers took one spin lock and a reader did not wait (phpGH-13437); a reader count and a writer flag now, the readers waiting for the writer and the writers for the readers, with a limit of retries for a crashed one
  Origin: php-src commit 3490ac0 (Jakub Zelenka, 07.09.2024, PHP 8.3.16), the commit of upstream that Ubuntu took in place of its first backport for 8.3.6 (noble, fix-fpm-scoreboard.patch, LP #2130569 and #2144556: the first one crashed php-fpm)
- backport-separate-live-range.patch: CVE-2024-11235 (GHSA-rwp7-7vc6-8477): the live range of the temporary that ZEND_SEPARATE defines again was ended there, which broke the handling of COPY_TMP: ??= on a property of the result of a call ($a->f()->p ??= ..., f()->p ??= ...), with __set or a typed property that throws, freed the value twice (a use-after-free). Fixed upstream in 8.3.19 and 8.4.5 only; the same code (zend_calc_live_ranges()) is in this branch
  Origin: php-src commit ef2c459 (Ilija Tovilo, 13.11.2024, PHP 8.3.19), with its three tests, as SUSE carries it for 7.4.33 and 8.0.30 (php7-CVE-2024-11235.patch, SLE 15) and Ubuntu for 7.4 (focal) and 8.1 (jammy) (CVE-2024-11235.patch)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); here zip_options was not initialized at all without an options array (remove_path and add_path read from the stack): the defaults are set at its declaration, the memset and defaults of php_zip_parse_options() of 8.2 dropped; its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); the n of php_zip_get_from() of 8.2 is an int: zip_int64_t now; its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); brought onto php_zip_add_file(), php_zip_add_from_pattern() and the callback registration of 8.2 by hand; its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); php_zip_extract_file() of 8.2 has no index argument; its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); the checks placed by hand as upstream, without setArchiveFlag() (8.3 and later), also in its test; its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
- backport-zip-17-gh21698-addglob-leak.patch: phpGH-21698: addGlob() did not free the glob() result when no file matched or open_basedir refused the match (PHP 8.4.21, not in this branch); with the array_init() of the no-match return here; its test expects NULL, which addGlob() returns here when open_basedir refuses the match; its tests taken
  Origin: php-src commit 391ec27 (David Carlier, 10.04.2026, PHP 8.4.21)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 21, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-zip-01-add-file-fd-leak.patch: php_zip_add_file() leaked the file it had opened for ZIP_FL_OPEN_FILE_NOW when zip_source_filep() failed (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 4c54dce (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
- backport-zip-17-gh21698-addglob-leak.patch: phpGH-21698: addGlob() did not free the glob() result when no file matched or open_basedir refused the match (PHP 8.4.21, not in this branch); its tests taken
  Origin: php-src commit 391ec27 (David Carlier, 10.04.2026, PHP 8.4.21)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 24, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-fpm-scoreboard-readers.patch: php-fpm: the status page and fpm_get_status() under load failed with "scoreboard: failed to lock (already locked)" while a worker updated the scoreboard, as readers and writers took one spin lock and a reader did not wait (phpGH-13437); a reader count and a writer flag now, the readers waiting for the writer and the writers for the readers, with a limit of retries for a crashed one
  Origin: php-src commit 3490ac0 (Jakub Zelenka, 07.09.2024, PHP 8.3.16), the commit of upstream that Ubuntu took in place of its first backport for 8.3.6 (noble, fix-fpm-scoreboard.patch, LP #2130569 and #2144556: the first one crashed php-fpm)
- backport-gd-font-uninitialized.patch: gd: imagefontwidth(), imagefontheight(), imagestring(), imagestringup(), imagechar() and imagecharup() with a font of imageloadfont() (a GdFont object) left the integer of the font uninitialised, which the font of the object was looked up with too: undefined behaviour, a wrong font with clang 14 and later at -Os (phpGH-13082); both initialised now
  Origin: php-src commits 1e464e5 and df85c25 (Niels Dossche, 09.01.2024 and 13.01.2024, PHP 8.2.15), as MacPorts carries them for php81 (lang/php/files/patch-php81-ext-gd.diff); their test needs a binary font file, which a patch cannot carry: left out
- 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/php74 and lang/php81 (patches/patch-ext_xml_compat.c) and MacPorts for php74, with its test (the SKIPIF of 8.1)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); here zip_options was not initialized at all without an options array (remove_path and add_path read from the stack): the defaults are set at its declaration, the memset and defaults of php_zip_parse_options() dropped; its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); brought onto getStream() and php_stream_zip_open() of 8.1, which has no getStreamIndex() and getStreamName(); its test with getStream() only; its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); the n of php_zip_get_from() is an int here: zip_int64_t now; its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); brought onto php_zip_add_file(), php_zip_add_from_pattern(), the callback registration and the stream opener of 8.1 by hand (8.1 has no clearError()); its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); php_zip_extract_file() has no index argument here; its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); the guard of getStream() of 8.1; its test without getStreamIndex() and getStreamName(); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); the checks placed by hand as upstream, without setArchiveFlag() (8.3 and later), also in its test; its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
- backport-zip-17-gh21698-addglob-leak.patch: phpGH-21698: addGlob() did not free the glob() result when no file matched or open_basedir refused the match (PHP 8.4.21, not in this branch); with the array_init() of the no-match return here; its test expects NULL, which addGlob() returns here when open_basedir refuses the match; its tests taken
  Origin: php-src commit 391ec27 (David Carlier, 10.04.2026, PHP 8.4.21)
- backport-zz-GHSA-658j-r8rw-q6mx-runtime.patch: GHSA-658j-r8rw-q6mx (CVE-2026-115560, the PHP security release of 19.11.2026): the session settings not to be changed at run time while session.upload_progress.enabled is on (an Error, as PHP 8.2 and later), the part of the fix Remi Collet's backport leaves out ("Default change only"; his commit of the default off and the reset in GINIT is upstream of this branch), with its test
  Origin: php-src commit 3f70f66 (Arnaud Le Blanc, 09.11.2026, PHP 8.2.36): its SESSION_CHECK_UPLOAD_PROGRESS_STATE and the INI handlers it guards; on the decision of aZ, 19.11.2026
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 24, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-fpm-scoreboard-readers.patch: php-fpm: the status page and fpm_get_status() under load failed with "scoreboard: failed to lock (already locked)" while a worker updated the scoreboard, as readers and writers took one spin lock and a reader did not wait (phpGH-13437); a reader count and a writer flag now, the readers waiting for the writer and the writers for the readers, with a limit of retries for a crashed one
  Origin: php-src commit 3490ac0 (Jakub Zelenka, 07.09.2024, PHP 8.3.16), the commit of upstream that Ubuntu took in place of its first backport for 8.3.6 (noble, fix-fpm-scoreboard.patch, LP #2130569 and #2144556: the first one crashed php-fpm)
- backport-separate-live-range.patch: CVE-2024-11235 (GHSA-rwp7-7vc6-8477): the live range of the temporary that ZEND_SEPARATE defines again was ended there, which broke the handling of COPY_TMP: ??= on a property of the result of a call ($a->f()->p ??= ..., f()->p ??= ...), with __set or a typed property that throws, freed the value twice (a use-after-free). Fixed upstream in 8.3.19 and 8.4.5 only; the same code (zend_calc_live_ranges()) is in this branch
  Origin: php-src commit ef2c459 (Ilija Tovilo, 13.11.2024, PHP 8.3.19), with its three tests, as SUSE carries it for 7.4.33 and 8.0.30 (php7-CVE-2024-11235.patch, SLE 15) and Ubuntu for 7.4 (focal) and 8.1 (jammy) (CVE-2024-11235.patch)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); here zip_options was not initialized at all without an options array (remove_path and add_path read from the stack): the defaults are set at its declaration, the memset and defaults of php_zip_parse_options() of 8.2 dropped; its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); the n of php_zip_get_from() of 8.2 is an int: zip_int64_t now; its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); brought onto php_zip_add_file(), php_zip_add_from_pattern() and the callback registration of 8.2 by hand; its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); php_zip_extract_file() of 8.2 has no index argument; its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); the checks placed by hand as upstream, without setArchiveFlag() (8.3 and later), also in its test; its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
- backport-zip-17-gh21698-addglob-leak.patch: phpGH-21698: addGlob() did not free the glob() result when no file matched or open_basedir refused the match (PHP 8.4.21, not in this branch); with the array_init() of the no-match return here; its test expects NULL, which addGlob() returns here when open_basedir refuses the match; its tests taken
  Origin: php-src commit 391ec27 (David Carlier, 10.04.2026, PHP 8.4.21)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 24, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-zip-01-add-file-fd-leak.patch: php_zip_add_file() leaked the file it had opened for ZIP_FL_OPEN_FILE_NOW when zip_source_filep() failed (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 4c54dce (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
- backport-zip-17-gh21698-addglob-leak.patch: phpGH-21698: addGlob() did not free the glob() result when no file matched or open_basedir refused the match (PHP 8.4.21, not in this branch); its tests taken
  Origin: php-src commit 391ec27 (David Carlier, 10.04.2026, PHP 8.4.21)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 25, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-fpm-scoreboard-readers.patch: php-fpm: the status page and fpm_get_status() under load failed with "scoreboard: failed to lock (already locked)" while a worker updated the scoreboard, as readers and writers took one spin lock and a reader did not wait (phpGH-13437); a reader count and a writer flag now, the readers waiting for the writer and the writers for the readers, with a limit of retries for a crashed one
  Origin: php-src commit 3490ac0 (Jakub Zelenka, 07.09.2024, PHP 8.3.16), the commit of upstream that Ubuntu took in place of its first backport for 8.3.6 (noble, fix-fpm-scoreboard.patch, LP #2130569 and #2144556: the first one crashed php-fpm)
- backport-gd-font-uninitialized.patch: gd: imagefontwidth(), imagefontheight(), imagestring(), imagestringup(), imagechar() and imagecharup() with a font of imageloadfont() (a GdFont object) left the integer of the font uninitialised, which the font of the object was looked up with too: undefined behaviour, a wrong font with clang 14 and later at -Os (phpGH-13082); both initialised now
  Origin: php-src commits 1e464e5 and df85c25 (Niels Dossche, 09.01.2024 and 13.01.2024, PHP 8.2.15), as MacPorts carries them for php81 (lang/php/files/patch-php81-ext-gd.diff); their test needs a binary font file, which a patch cannot carry: left out
- backport-xml-libxml213-entities.patch: ext/xml with libxml2 2.13 and later (that of azsupport 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/php74 and lang/php81 (patches/patch-ext_xml_compat.c) and MacPorts for php74, with its test (the SKIPIF of 8.1)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); here zip_options was not initialized at all without an options array (remove_path and add_path read from the stack): the defaults are set at its declaration, the memset and defaults of php_zip_parse_options() dropped; its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); brought onto getStream() and php_stream_zip_open() of 8.1, which has no getStreamIndex() and getStreamName(); its test with getStream() only; its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); the n of php_zip_get_from() is an int here: zip_int64_t now; its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); brought onto php_zip_add_file(), php_zip_add_from_pattern(), the callback registration and the stream opener of 8.1 by hand (8.1 has no clearError()); its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); php_zip_extract_file() has no index argument here; its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); the guard of getStream() of 8.1; its test without getStreamIndex() and getStreamName(); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); the checks placed by hand as upstream, without setArchiveFlag() (8.3 and later), also in its test; its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
- backport-zip-17-gh21698-addglob-leak.patch: phpGH-21698: addGlob() did not free the glob() result when no file matched or open_basedir refused the match (PHP 8.4.21, not in this branch); with the array_init() of the no-match return here; its test expects NULL, which addGlob() returns here when open_basedir refuses the match; its tests taken
  Origin: php-src commit 391ec27 (David Carlier, 10.04.2026, PHP 8.4.21)
- backport-zz-GHSA-658j-r8rw-q6mx-runtime.patch: GHSA-658j-r8rw-q6mx (CVE-2026-115560, the PHP security release of 19.11.2026): the session settings not to be changed at run time while session.upload_progress.enabled is on (an Error, as PHP 8.2 and later), the part of the fix Remi Collet's backport leaves out ("Default change only"; his commit of the default off and the reset in GINIT is upstream of this branch), with its test
  Origin: php-src commit 3f70f66 (Arnaud Le Blanc, 09.11.2026, PHP 8.2.36): its SESSION_CHECK_UPLOAD_PROGRESS_STATE and the INI handlers it guards; on the decision of aZ, 19.11.2026
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 25, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-fpm-scoreboard-readers.patch: php-fpm: the status page and fpm_get_status() under load failed with "scoreboard: failed to lock (already locked)" while a worker updated the scoreboard, as readers and writers took one spin lock and a reader did not wait (phpGH-13437); a reader count and a writer flag now, the readers waiting for the writer and the writers for the readers, with a limit of retries for a crashed one
  Origin: php-src commit 3490ac0 (Jakub Zelenka, 07.09.2024, PHP 8.3.16), the commit of upstream that Ubuntu took in place of its first backport for 8.3.6 (noble, fix-fpm-scoreboard.patch, LP #2130569 and #2144556: the first one crashed php-fpm)
- backport-separate-live-range.patch: CVE-2024-11235 (GHSA-rwp7-7vc6-8477): the live range of the temporary that ZEND_SEPARATE defines again was ended there, which broke the handling of COPY_TMP: ??= on a property of the result of a call ($a->f()->p ??= ..., f()->p ??= ...), with __set or a typed property that throws, freed the value twice (a use-after-free). Fixed upstream in 8.3.19 and 8.4.5 only; the same code (zend_calc_live_ranges()) is in this branch
  Origin: php-src commit ef2c459 (Ilija Tovilo, 13.11.2024, PHP 8.3.19), with its three tests, as SUSE carries it for 7.4.33 and 8.0.30 (php7-CVE-2024-11235.patch, SLE 15) and Ubuntu for 7.4 (focal) and 8.1 (jammy) (CVE-2024-11235.patch)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); here zip_options was not initialized at all without an options array (remove_path and add_path read from the stack): the defaults are set at its declaration, the memset and defaults of php_zip_parse_options() of 8.2 dropped; its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); the n of php_zip_get_from() of 8.2 is an int: zip_int64_t now; its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); brought onto php_zip_add_file(), php_zip_add_from_pattern() and the callback registration of 8.2 by hand; its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); php_zip_extract_file() of 8.2 has no index argument; its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); the checks placed by hand as upstream, without setArchiveFlag() (8.3 and later), also in its test; its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
- backport-zip-17-gh21698-addglob-leak.patch: phpGH-21698: addGlob() did not free the glob() result when no file matched or open_basedir refused the match (PHP 8.4.21, not in this branch); with the array_init() of the no-match return here; its test expects NULL, which addGlob() returns here when open_basedir refuses the match; its tests taken
  Origin: php-src commit 391ec27 (David Carlier, 10.04.2026, PHP 8.4.21)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 25, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-zip-01-add-file-fd-leak.patch: php_zip_add_file() leaked the file it had opened for ZIP_FL_OPEN_FILE_NOW when zip_source_filep() failed (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 4c54dce (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
- backport-zip-17-gh21698-addglob-leak.patch: phpGH-21698: addGlob() did not free the glob() result when no file matched or open_basedir refused the match (PHP 8.4.21, not in this branch); its tests taken
  Origin: php-src commit 391ec27 (David Carlier, 10.04.2026, PHP 8.4.21)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 25, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-fpm-scoreboard-readers.patch: php-fpm: the status page and fpm_get_status() under load failed with "scoreboard: failed to lock (already locked)" while a worker updated the scoreboard, as readers and writers took one spin lock and a reader did not wait (phpGH-13437); a reader count and a writer flag now, the readers waiting for the writer and the writers for the readers, with a limit of retries for a crashed one
  Origin: php-src commit 3490ac0 (Jakub Zelenka, 07.09.2024, PHP 8.3.16), the commit of upstream that Ubuntu took in place of its first backport for 8.3.6 (noble, fix-fpm-scoreboard.patch, LP #2130569 and #2144556: the first one crashed php-fpm)
- backport-separate-live-range.patch: CVE-2024-11235 (GHSA-rwp7-7vc6-8477): the live range of the temporary that ZEND_SEPARATE defines again was ended there, which broke the handling of COPY_TMP: ??= on a property of the result of a call ($a->f()->p ??= ..., f()->p ??= ...), with __set or a typed property that throws, freed the value twice (a use-after-free). Fixed upstream in 8.3.19 and 8.4.5 only; the same code (zend_calc_live_ranges()) is in this branch
  Origin: php-src commit ef2c459 (Ilija Tovilo, 13.11.2024, PHP 8.3.19), with its three tests, as SUSE carries it for 7.4.33 and 8.0.30 (php7-CVE-2024-11235.patch, SLE 15) and Ubuntu for 7.4 (focal) and 8.1 (jammy) (CVE-2024-11235.patch)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); here zip_options was not initialized at all without an options array (remove_path and add_path read from the stack): the defaults are set at its declaration, the memset and defaults of php_zip_parse_options() of 8.2 dropped; its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); the n of php_zip_get_from() of 8.2 is an int: zip_int64_t now; its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); brought onto php_zip_add_file(), php_zip_add_from_pattern() and the callback registration of 8.2 by hand; its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); php_zip_extract_file() of 8.2 has no index argument; its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); the checks placed by hand as upstream, without setArchiveFlag() (8.3 and later), also in its test; its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
- backport-zip-17-gh21698-addglob-leak.patch: phpGH-21698: addGlob() did not free the glob() result when no file matched or open_basedir refused the match (PHP 8.4.21, not in this branch); with the array_init() of the no-match return here; its test expects NULL, which addGlob() returns here when open_basedir refuses the match; its tests taken
  Origin: php-src commit 391ec27 (David Carlier, 10.04.2026, PHP 8.4.21)
azsupport added a commit to azsupport/php-src that referenced this pull request Nov 25, 2026
Interim backports carried until the upstream branch has its own fix:
- backport-zip-01-add-file-fd-leak.patch: php_zip_add_file() leaked the file it had opened for ZIP_FL_OPEN_FILE_NOW when zip_source_filep() failed (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 4c54dce (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-02-pcre-name-leak.patch: php_zip_pcre() (addPattern()) freed only the current name when a path was too long and returned, leaking the rest of the list (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit c4d4cea (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-03-get-from-fread-leak.patch: getFromName() and getFromIndex() did not close the entry when zip_fread() failed or read nothing (PHP 8.4.23, not in this branch); its tests taken
  Origin: php-src commit 17f6752 (ndossche, 06.06.2026, PHP 8.4.23)
- backport-zip-04-gh21705-fl-unchanged.patch: phpGH-21705: getFromIndex() with ZipArchive::FL_UNCHANGED stated the current entry instead of the original, so it read the wrong length of a changed entry (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit bc3a7c7 (Weilin Du, 03.07.2026, PHP 8.4.24)
- backport-zip-05-gh22649-comment-uaf.patch: phpGH-22649: setting the inherited comment of an entry again after the entry was overwritten used a comment libzip had freed (a use-after-free in PHP_ZIP_SET_FILE_COMMENT) (PHP 8.4.24, not in this branch); its tests taken
  Origin: php-src commit ebed41a (Weilin Du, 10.07.2026, PHP 8.4.24)
- backport-zip-06-addglob-default-options.patch: phpGH-23108: addGlob() and addPattern() without options stored the entries uncompressed and failed on an existing name instead of replacing it, the defaults being applied only with an options array (PHP 8.4.25, not in this branch); its tests taken
  Origin: php-src commit 8d5b0d6 (David Carlier, 08.08.2026, PHP 8.4.25)
- backport-zip-07-gh17787-stream-owner.patch: phpGH-17787: a stream of getStream() borrows the zip_t of the archive; freeing the ZipArchive while the stream was open closed the archive under it (a short read, the pending changes lost); the stream keeps the archive alive now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 5a326b9 (Eyüp Can Akman, 14.08.2026, PHP 8.4.26)
- backport-zip-08-gh23240-crc-errors.patch: phpGH-23240: extractTo() took a failed read (the CRC error of a corrupted entry) for success and wrote the corrupt data, and getFromName() and getFromIndex() never read up to the CRC check and returned such data silently; read errors fail with a warning now (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 2a2b337 (David Carlier, 13.08.2026, PHP 8.4.26)
- backport-zip-09-phpinfo-aes.patch: phpinfo() reported the AES-128 support for AES-192 and AES-256 (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit d9c58ee (Weilin Du, 17.08.2026, PHP 8.4.26)
- backport-zip-10-gh23276-archive-state.patch: phpGH-23276: with the stream keeping the archive alive, a ZipArchive subclass holding its own stream was a cycle the GC could not collect; the native state of the archive (zip_t, callbacks) is a refcounted object of its own now, which the streams keep (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit f49b94e (Weilin Du, 25.08.2026, PHP 8.4.26)
- backport-zip-11-getnameindex-int.patch: getNameIndex() cast the index to int, so an index past 2^32 wrapped and named another entry (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 473a7e0 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-12-stat-open-fail.patch: phpGH-23511: fstat() of a zip:// stream succeeded with an empty stat when the archive could not be opened (PHP 8.4.26, not in this branch); its tests taken
  Origin: php-src commit 614afe7 (David Carlier, 29.08.2026, PHP 8.4.26)
- backport-zip-13-extractto-non-list.patch: extractTo() with an array of names that is not a list skipped the names whose key was not an index below the count (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 214ed7e (David Carlier, 10.09.2026, PHP 8.4.27)
- backport-zip-14-gh23747-close-callback-uaf.patch: phpGH-23747: close() or open() called from a progress or cancel callback ran a nested zip_close() and freed the archive the outer zip_close() still used (a use-after-free); they throw meanwhile now (PHP 8.4.27, not in this branch); its tests taken
  Origin: php-src commit 132403d (David Carlier, 18.09.2026, PHP 8.4.27)
- backport-zip-15-gh23779-destructor-uaf.patch: phpGH-23779: a ZipArchive destroyed without close() while its progress or cancel callback ran nested zip_close() and freed the archive in use (a use-after-free); no new stream while closing, no callback destructors after the engine shutdown (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit 303e6aa (jvoisin, 19.09.2026, PHP 8.4.28)
- backport-zip-16-gh24025-close-mutators.patch: phpGH-24025: a progress or cancel callback could delete or unchange entries inside zip_close() after libzip had fixed its list (a use-after-free of a dirent) or change the archive with the changes dropped; every mutator throws "Already being closed" then (PHP 8.4.28, not in this branch); its tests taken
  Origin: php-src commit acd5fe8 (Ilia Alshanetsky, 24.09.2026, PHP 8.4.28)
- backport-zip-17-gh21698-addglob-leak.patch: phpGH-21698: addGlob() did not free the glob() result when no file matched or open_basedir refused the match (PHP 8.4.21, not in this branch); its tests taken
  Origin: php-src commit 391ec27 (David Carlier, 10.04.2026, PHP 8.4.21)
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