diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 2a3537a8cae..040e9d4f1b1 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -688,8 +688,9 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip); } + ret = globbuf.gl_pathc; globfree(&globbuf); - return globbuf.gl_pathc; + return ret; #else zend_throw_error(NULL, "Glob support is not available"); return 0;