From cf540d0c6e783d56819a261e6a62da7f361890a1 Mon Sep 17 00:00:00 2001 From: lamentxu <1372449351@qq.com> Date: Sun, 29 Mar 2026 20:38:50 +0800 Subject: [PATCH] Update php_zip.c --- ext/zip/php_zip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 77d5dacbff94e..8798112425f9e 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -709,7 +709,7 @@ int php_zip_glob(zend_string *spattern, zend_long flags, zval *return_value) /* return -1; } - array_init(return_value); + array_init_size(return_value, (uint32_t)globbuf.gl_pathc); for (size_t n = 0; n < globbuf.gl_pathc; n++) { /* we need to do this every time since PHP_GLOB_ONLYDIR does not guarantee that * all directories will be filtered. GNU libc documentation states the @@ -788,7 +788,7 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val return -1; } - array_init(return_value); + array_init_size(return_value, (uint32_t)files_cnt); /* only the files, directories are ignored */ for (i = 0; i < files_cnt; i++) {