[php-src] PR #21708: Fix GH-21682: Add NOT_SERIALIZABLE to ZipArchive
| From: | iliaal | Date: | Fri, 10 Apr 2026 11:01:09 +0000 |
| Subject: | [php-src] PR #21708: Fix GH-21682: Add NOT_SERIALIZABLE to ZipArchive | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35655@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21708
Author: iliaal
Part of #21682, split from #21694 after review feedback.
ZipArchive wraps a libzip archive handle that can't survive serialization.
serialize() produces a string, but unserializing it returns an object where
numFiles reports 0 and the archive contents are gone.
Adds @not-serializable so serialize() throws instead of producing a broken
object.
The UAF exploit test bug72434.phpt instantiated ZipArchive via
unserialize(). With NOT_SERIALIZABLE, unserialize() rejects
the class and closes the UAF vector. The test also moves to ext/zip/tests/ since it
exercises ZipArchive.
Per the discussion on #21694, ZipArchive::closeString() (in flight as #21497) gives
subclasses a way to capture archive state, so this decision is worth revisiting once that lands.