From 5c1dad8e361a886b36d0c9bd6528870479f7a45d Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 16 Feb 2025 00:16:04 +0100 Subject: [PATCH] Revert "Fix Windows build for GH-17814 and add extension dependency (#17819)" This reverts commit 5cce35c647e3dcae410c4d59f994aef6e4468372. --- ext/phar/tests/gh17808.phpt | 1 - ext/phar/util.c | 38 ++++++++++--------------------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/ext/phar/tests/gh17808.phpt b/ext/phar/tests/gh17808.phpt index 03e54ff264bf..28cb9a2e2279 100644 --- a/ext/phar/tests/gh17808.phpt +++ b/ext/phar/tests/gh17808.phpt @@ -2,7 +2,6 @@ GH-17808 (PharFileInfo refcount bug) --EXTENSIONS-- phar -zlib --FILE-- is_persistent) { @@ -1254,12 +1245,16 @@ phar_entry_info *phar_get_entry_info(phar_archive_data *phar, const char *path, * valid pre-existing empty directory entries */ // TODO: convert this to use zend_string too -static phar_entry_info *phar_get_entry_info_dir_ex(phar_archive_data *phar, const char *path, size_t path_len, char dir, char **error, int security) /* {{{ */ +phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, const char *path, size_t path_len, char dir, char **error, int security) /* {{{ */ { const char *pcr_error; phar_entry_info *entry; int is_dir; +#ifdef PHP_WIN32 + phar_unixify_path_separators(path, path_len); +#endif + is_dir = (path_len && (path[path_len - 1] == '/')) ? 1 : 0; if (error) { @@ -1406,19 +1401,6 @@ static phar_entry_info *phar_get_entry_info_dir_ex(phar_archive_data *phar, cons } /* }}} */ -phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, const char *path, size_t path_len, char dir, char **error, int security) -{ -#ifdef PHP_WIN32 - char *path_dup = estrndup(path, path_len); - phar_unixify_path_separators(path_dup, path_len); - phar_entry_info *ret = phar_get_entry_info_dir_ex(phar, path_dup, path_len, dir, error, security); - efree(path_dup); - return ret; -#else - return phar_get_entry_info_dir_ex(phar, path, path_len, dir, error, security); -#endif -} - static const char hexChars[] = "0123456789ABCDEF"; static int phar_hex_str(const char *digest, size_t digest_len, char **signature) /* {{{ */