From 13e4ce386bb7257dbbe3167b070382ea959ec763 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 26 Feb 2021 02:28:46 +0300 Subject: Improve SPL directory and stat() cache using zend_srting* instead of char* --- ext/zip/php_zip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'ext/zip/php_zip.c') diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index a3b266bba8..e62f9fc8f9 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -280,8 +280,7 @@ static int php_zip_add_file(ze_zip_object *obj, const char *filename, size_t fil { struct zip_source *zs; char resolved_path[MAXPATHLEN]; - zval exists_flag; - + php_stream_statbuf ssb; if (ZIP_OPENBASEDIR_CHECKPATH(filename)) { return -1; @@ -292,8 +291,7 @@ static int php_zip_add_file(ze_zip_object *obj, const char *filename, size_t fil return -1; } - php_stat(resolved_path, strlen(resolved_path), FS_EXISTS, &exists_flag); - if (Z_TYPE(exists_flag) == IS_FALSE) { + if (php_stream_stat_path_ex(resolved_path, PHP_STREAM_URL_STAT_QUIET, &ssb, NULL)) { php_error_docref(NULL, E_WARNING, "No such file or directory"); return -1; } -- cgit v1.2.1