Commit 1ea350861a4 for php
commit 1ea350861a4c3910090345d540723c4bbf175fff
Author: Daniel Scherzer <daniel.e.scherzer+phpf@gmail.com>
Date: Mon Sep 28 17:25:19 2026 -0700
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.
diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c
index 429342b36e3..d954796743d 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;