[php-src] PR #22555: Fix GH-17787: ZipArchive stream truncates when the archive is freed

From: Date: Thu, 02 Jul 2026 14:28:46 +0000
Subject: [php-src] PR #22555: Fix GH-17787: ZipArchive stream truncates when the archive is freed
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-36782@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22555 Author: eyupcanakman ZipArchive::getStreamIndex() (and getStream/getStreamName) hands back a stream that reads from the archive's underlying zip_t without keeping a reference to it. When the ZipArchive object is freed while the stream is still open, as in the report where $z gets reassigned inside the read loop, the object destructor closes the zip_t and the stream stops reading early. cmb69 diagnosed this on the issue. The fix keeps the archive object alive for the stream's lifetime, so the borrowed handle stays valid until the stream is closed. One case this does not cover is calling $zip->close() or reopening the same object while a stream is open, which hits the same truncation by a different route. I can extend the fix to those paths if you prefer.

« previous php.git-pulls (#36782) next »