Commit 556757dcfff for php.net
commit 556757dcfff99285fce696b49573e86abee0aa95
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date: Fri Apr 10 07:57:12 2026 -0400
Fix build: use php_globfree wrapper in ZipArchive::addGlob early returns
GH-21702 added two `globfree()` calls at the no-match and open_basedir
reject paths, but called `globfree` directly instead of the `php_globfree`
wrapper used at the success path below. PHP-8.5 dropped the direct
`<glob.h>` include from `ext/zip/php_zip.c` in favor of the `php_glob.h`
wrapper, so the build now breaks with
`-Werror=implicit-function-declaration` on systems where `<glob.h>` isn't
transitively included.
Match the existing wrapper usage at line 675.
close GH-21709
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index d6060d95ce8..5202e9280ba 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -636,14 +636,14 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
/* now catch the FreeBSD style of "no matches" */
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
- globfree(&globbuf);
+ php_globfree(&globbuf);
return 0;
}
/* we assume that any glob pattern will match files from one directory only
so checking the dirname of the first match should be sufficient */
if (ZIP_OPENBASEDIR_CHECKPATH(globbuf.gl_pathv[0])) {
- globfree(&globbuf);
+ php_globfree(&globbuf);
return -1;
}