Skip to content

Commit 5c1dad8

Browse files
committed
Revert "Fix Windows build for GH-17814 and add extension dependency (#17819)"
This reverts commit 5cce35c.
1 parent dbea8d3 commit 5c1dad8

File tree

2 files changed

+10
-29
lines changed

2 files changed

+10
-29
lines changed

ext/phar/tests/gh17808.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
GH-17808 (PharFileInfo refcount bug)
33
--EXTENSIONS--
44
phar
5-
zlib
65
--FILE--
76
<?php
87
$fname = __DIR__.'/tar/files/Structures_Graph-1.0.3.tgz';

ext/phar/util.c

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -632,14 +632,18 @@ zend_result phar_get_entry_data(phar_entry_data **ret, char *fname, size_t fname
632632
/**
633633
* Create a new dummy file slot within a writeable phar for a newly created file
634634
*/
635-
static phar_entry_data *phar_get_or_create_entry_data_ex(char *fname, size_t fname_len, const char *path, size_t path_len, const char *mode, char allow_dir, char **error, int security) /* {{{ */
635+
phar_entry_data *phar_get_or_create_entry_data(char *fname, size_t fname_len, const char *path, size_t path_len, const char *mode, char allow_dir, char **error, int security) /* {{{ */
636636
{
637637
phar_archive_data *phar;
638638
phar_entry_info *entry, etemp;
639639
phar_entry_data *ret;
640640
const char *pcr_error;
641641
char is_dir;
642642

643+
#ifdef PHP_WIN32
644+
phar_unixify_path_separators(path, path_len);
645+
#endif
646+
643647
is_dir = (path_len && path[path_len - 1] == '/') ? 1 : 0;
644648

645649
if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, error)) {
@@ -727,19 +731,6 @@ static phar_entry_data *phar_get_or_create_entry_data_ex(char *fname, size_t fna
727731
}
728732
/* }}} */
729733

730-
phar_entry_data *phar_get_or_create_entry_data(char *fname, size_t fname_len, const char *path, size_t path_len, const char *mode, char allow_dir, char **error, int security)
731-
{
732-
#ifdef PHP_WIN32
733-
char *path_dup = estrndup(path, path_len);
734-
phar_unixify_path_separators(path_dup, path_len);
735-
phar_entry_data *ret = phar_get_or_create_entry_data_ex(fname, fname_len, path_dup, path_len, mode, allow_dir, error, security);
736-
efree(path_dup);
737-
return ret;
738-
#else
739-
return phar_get_or_create_entry_data_ex(fname, fname_len, path, path_len, mode, allow_dir, error, security);
740-
#endif
741-
}
742-
743734
static inline void phar_set_pharfp(phar_archive_data *phar, php_stream *fp)
744735
{
745736
if (!phar->is_persistent) {
@@ -1254,12 +1245,16 @@ phar_entry_info *phar_get_entry_info(phar_archive_data *phar, const char *path,
12541245
* valid pre-existing empty directory entries
12551246
*/
12561247
// TODO: convert this to use zend_string too
1257-
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) /* {{{ */
1248+
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) /* {{{ */
12581249
{
12591250
const char *pcr_error;
12601251
phar_entry_info *entry;
12611252
int is_dir;
12621253

1254+
#ifdef PHP_WIN32
1255+
phar_unixify_path_separators(path, path_len);
1256+
#endif
1257+
12631258
is_dir = (path_len && (path[path_len - 1] == '/')) ? 1 : 0;
12641259

12651260
if (error) {
@@ -1406,19 +1401,6 @@ static phar_entry_info *phar_get_entry_info_dir_ex(phar_archive_data *phar, cons
14061401
}
14071402
/* }}} */
14081403

1409-
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)
1410-
{
1411-
#ifdef PHP_WIN32
1412-
char *path_dup = estrndup(path, path_len);
1413-
phar_unixify_path_separators(path_dup, path_len);
1414-
phar_entry_info *ret = phar_get_entry_info_dir_ex(phar, path_dup, path_len, dir, error, security);
1415-
efree(path_dup);
1416-
return ret;
1417-
#else
1418-
return phar_get_entry_info_dir_ex(phar, path, path_len, dir, error, security);
1419-
#endif
1420-
}
1421-
14221404
static const char hexChars[] = "0123456789ABCDEF";
14231405

14241406
static int phar_hex_str(const char *digest, size_t digest_len, char **signature) /* {{{ */

0 commit comments

Comments
 (0)