Skip to content

Commit eab12bd

Browse files
committed
Revert "Drop dead Windows code"
This reverts commit 22dc59d.
1 parent 897dcd5 commit eab12bd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ext/phar/phar.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,12 +2220,21 @@ zend_string* phar_split_fname_ex(const char *filename, size_t filename_len, char
22202220
if (entry) {
22212221
if (ext_str[ext_len]) {
22222222
size_t computed_entry_len = filename_len - arch_len;
2223-
/* We don't need to unixify the path on Windows,
2224-
* as ext_str is derived from filename that was already unixify */
2223+
#ifdef PHP_WIN32
2224+
/* TODO: can we handle the unixify path in phar_fix_filepath() directly ? */
2225+
char *fixed_path_for_windows = estrndup(ext_str+ext_len, computed_entry_len);
2226+
phar_unixify_path_separators(fixed_path_for_windows, computed_entry_len);
2227+
zend_string *entry_str = phar_fix_filepath(fixed_path_for_windows, computed_entry_len, false);
2228+
*entry = estrndup(ZSTR_VAL(entry_str), ZSTR_LEN(entry_str));
2229+
*entry_len = ZSTR_LEN(entry_str);
2230+
zend_string_release_ex(entry_str, false);
2231+
efree(fixed_path_for_windows);
2232+
#else
22252233
zend_string *entry_str = phar_fix_filepath(ext_str+ext_len, computed_entry_len, false);
22262234
*entry = estrndup(ZSTR_VAL(entry_str), ZSTR_LEN(entry_str));
22272235
*entry_len = ZSTR_LEN(entry_str);
22282236
zend_string_release_ex(entry_str, false);
2237+
#endif
22292238
} else {
22302239
*entry_len = 1;
22312240
*entry = estrndup("/", 1);

0 commit comments

Comments
 (0)