[php-src] master: ext/zip: use `ZIP_RDONLY` when calling `zip_open()` in zip_stream.c

From: Date: Fri, 23 Oct 2026 01:58:58 +0000
Subject: [php-src] master: ext/zip: use `ZIP_RDONLY` when calling `zip_open()` in zip_stream.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142616@lists.php.net to get a copy of this message
Author: Daniel Scherzer (DanielEScherzer) Date: 2026-10-22T18:00:36-07:00 Commit: https://github.com/php/php-src/commit/1ea350861a4c3910090345d540723c4bbf175fff Raw diff: https://github.com/php/php-src/commit/1ea350861a4c3910090345d540723c4bbf175fff.diff ext/zip: use ZIP_RDONLY when calling zip_open() in zip_stream.c The code paths that call zip_open() are used for stats and reading, not writing. Previously ZIP_CREATE would create an in-memory zip archive, and if it were written to, would persist it to disk when closed, but since the archive was never written to, this functionality was unneeded. Use the ZIP_RDONLY flag to make it clearer that the zip archive is not being written to. Changed paths: M ext/zip/zip_stream.c Diff: diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c index 429342b36e3d..d954796743da 100644 --- a/ext/zip/zip_stream.c +++ b/ext/zip/zip_stream.c @@ -162,7 +162,7 @@ static int php_zip_ops_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{ return -1; } - za = zip_open(file_dirname, ZIP_CREATE, &err); + za = zip_open(file_dirname, ZIP_RDONLY, &err); if (za) { memset(ssb, 0, sizeof(php_stream_statbuf)); if (zip_stat(za, fragment, ZIP_FL_NOCASE, &sb) != 0) { @@ -332,7 +332,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, return NULL; } - za = zip_open(file_dirname, ZIP_CREATE, &err); + za = zip_open(file_dirname, ZIP_RDONLY, &err); if (za) { zval *tmpzval;

« previous php.cvs (#142616) next »