Skip to content

ext/zip: Reject ZipArchive mutators during close() - #24025

Closed
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:fix/aph-zip-close-mutator-reentry-v0oc-84-work
Closed

iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:fix/aph-zip-close-mutator-reentry-v0oc-84-work

Conversation

@iliaal

@iliaal iliaal commented Sep 30, 2026

Copy link
Copy Markdown
Member

Follow-up to GH-23749. A progress or cancel callback runs inside zip_close() after libzip has built the list of entries it will write, so changing the archive from the callback is never honored and can crash: deleteIndex(0) from a progress callback segfaults on a freed or NULLed dirent, deleting a later entry makes close() fail with "Internal error" and lose the archive, and additions are silently dropped. Every method that modifies the archive now throws the same "Already being closed" Error that close() and open() raise since GH-23749, through the php_zipobj_closing() helper that already exists on 8.6. Read-only methods are unchanged since libzip already refuses to reopen an entry it is writing. The zip_close() in the destructor does not set the flag; #23779 handles that separately.

/cc @devnexen

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

I think the idea is good. I'd prefer you add the following tests though

--TEST--
ZipArchive mutators throw when called from a cancel callback during close()
--EXTENSIONS--
zip
--SKIPIF--
<?php
if (!method_exists(ZipArchive::class, 'registerCancelCallback')) {
    die('skip cancel callbacks are not supported');
}
?>
--FILE--
<?php
$filename = __DIR__ . '/zip_close_mutator_reentry_cancel.zip';
$zip = new ZipArchive();
$zip->open($filename, ZipArchive::CREATE | ZipArchive::OVERWRITE);
$zip->addFromString('a.txt', str_repeat('a', 100000));
$zip->addFromString('b.txt', str_repeat('b', 100000));
$zip->registerCancelCallback(function () use ($zip) {
    static $done = false;
    if ($done) {
        return 0;
    }
    $done = true;
    $mutators = [
        'deleteIndex' => fn() => $zip->deleteIndex(0),
        'addFromString' => fn() => $zip->addFromString('c.txt', 'c'),
        'registerCancelCallback' => fn() => $zip->registerCancelCallback(fn() => 0),
    ];
    foreach ($mutators as $name => $mutator) {
        try {
            var_dump($mutator());
        } catch (Error $e) {
            echo $name, ': ', $e::class, ': ', $e->getMessage(), PHP_EOL;
        }
    }
    return 0;
});
var_dump($zip->close());
var_dump($zip->open($filename, ZipArchive::CHECKCONS));
var_dump($zip->numFiles);
var_dump($zip->getFromName('a.txt') === str_repeat('a', 100000));
var_dump($zip->getFromName('b.txt') === str_repeat('b', 100000));
$zip->close();
?>
--CLEAN--
<?php
@unlink(__DIR__ . '/zip_close_mutator_reentry_cancel.zip');
?>
--EXPECT--
deleteIndex: Error: Already being closed
addFromString: Error: Already being closed
registerCancelCallback: Error: Already being closed
bool(true)
bool(true)
int(2)
bool(true)
bool(true)

and

--TEST--
ZipArchive mutators throw when open() implicitly closes the previous archive
--EXTENSIONS--
zip
--SKIPIF--
<?php
if (!method_exists(ZipArchive::class, 'registerProgressCallback')) {
    die('skip progress callbacks are not supported');
}
?>
--FILE--
<?php
$filename = __DIR__ . '/zip_close_mutator_reentry_open.zip';
$nextFilename = __DIR__ . '/zip_close_mutator_reentry_open_next.zip';
$zip = new ZipArchive();
$zip->open($filename, ZipArchive::CREATE | ZipArchive::OVERWRITE);
$zip->addFromString('a.txt', str_repeat('a', 100000));
$zip->addFromString('b.txt', str_repeat('b', 100000));
$zip->registerProgressCallback(0.0, function ($rate) use ($zip) {
    static $done = false;
    if ($done || $rate <= 0) {
        return;
    }
    $done = true;
    $mutators = [
        'deleteIndex' => fn() => $zip->deleteIndex(0),
        'addFromString' => fn() => $zip->addFromString('c.txt', 'c'),
        'registerProgressCallback' => fn() => $zip->registerProgressCallback(0.5, function () {}),
    ];
    foreach ($mutators as $name => $mutator) {
        try {
            var_dump($mutator());
        } catch (Error $e) {
            echo $name, ': ', $e::class, ': ', $e->getMessage(), PHP_EOL;
        }
    }
});
var_dump($zip->open($nextFilename, ZipArchive::CREATE | ZipArchive::OVERWRITE));
var_dump($zip->addFromString('new.txt', 'new contents'));
var_dump($zip->close());
var_dump($zip->open($filename, ZipArchive::CHECKCONS));
var_dump($zip->numFiles);
var_dump($zip->getFromName('a.txt') === str_repeat('a', 100000));
var_dump($zip->getFromName('b.txt') === str_repeat('b', 100000));
$zip->close();
var_dump($zip->open($nextFilename, ZipArchive::CHECKCONS));
var_dump($zip->numFiles);
var_dump($zip->getFromName('new.txt') === 'new contents');
$zip->close();
?>
--CLEAN--
<?php
@unlink(__DIR__ . '/zip_close_mutator_reentry_open.zip');
@unlink(__DIR__ . '/zip_close_mutator_reentry_open_next.zip');
?>
--EXPECT--
deleteIndex: Error: Already being closed
addFromString: Error: Already being closed
registerProgressCallback: Error: Already being closed
bool(true)
bool(true)
bool(true)
bool(true)
int(2)
bool(true)
bool(true)
bool(true)
int(1)
bool(true)

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, and other
changes are either dropped or make the close fail and lose the archive.
Throw the Error that close() and open() already raise in that state from
every method that modifies the archive.
@iliaal
iliaal force-pushed the fix/aph-zip-close-mutator-reentry-v0oc-84-work branch from 831fe15 to dd200bb Compare October 4, 2026 14:29
@iliaal

iliaal commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

Thanks, added both

@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. Please leave this to me I want to check this again before I merge.

LamentXU123 added a commit that referenced this pull request Oct 8, 2026
* PHP-8.6:
  ext/zip: Reject ZipArchive mutators during close() (#24025)
@LamentXU123

Copy link
Copy Markdown
Member

Thanks!

damek24 pushed a commit to damek24/php-src that referenced this pull request Oct 8, 2026
* PHP-8.4:
  ext/zip: Reject ZipArchive mutators during close() (php#24025)
damek24 pushed a commit to damek24/php-src that referenced this pull request Oct 8, 2026
* PHP-8.5:
  ext/zip: Reject ZipArchive mutators during close() (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
  ...
arnaud-lb added a commit to nicolas-grekas/php-src that referenced this pull request Oct 12, 2026
* PHP-8.4: (33 commits)
  Update NEWS
  ext/mbstring: Fix truncated encoding names resolving to full names (php#23974)
  Backport PCRE2 security fixes to bundled 10.40
  Fix backport
  ext/pdo: Avoid a duplicate warning for a rejected statement class
  phpdbg: Fix wrong command names
  Backport phpGH-24241 to 8.4
  [ci skip] Update EXTENSIONS and CODEOWNERS for ext/readline
  Fix throwing behaviour with recursive arrays in VM
  Fix phpGH-24229: Use SHUT_WR when closing FastCGI connections (php#24230)
  Add regression test for phpGH-16821 (php#24228)
  Fix use-after-free when removing a failing zlib.inflate filter (php#24176)
  Fix phpGH-24218: Invalid opcode for count() of a literal array without SCCP
  fix: system ID for Apache graceful restart (php#24184)
  ext/standard: Validate the bcrypt cost before reading it
  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
  ...
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.

2 participants