@@ -632,18 +632,14 @@ 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- 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 ) /* {{{ */
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 ) /* {{{ */
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-
647643 is_dir = (path_len && path [path_len - 1 ] == '/' ) ? 1 : 0 ;
648644
649645 if (FAILURE == phar_get_archive (& phar , fname , fname_len , NULL , 0 , error )) {
@@ -731,6 +727,19 @@ phar_entry_data *phar_get_or_create_entry_data(char *fname, size_t fname_len, co
731727}
732728/* }}} */
733729
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+
734743static inline void phar_set_pharfp (phar_archive_data * phar , php_stream * fp )
735744{
736745 if (!phar -> is_persistent ) {
@@ -1245,16 +1254,12 @@ phar_entry_info *phar_get_entry_info(phar_archive_data *phar, const char *path,
12451254 * valid pre-existing empty directory entries
12461255 */
12471256// TODO: convert this to use zend_string too
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 ) /* {{{ */
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 ) /* {{{ */
12491258{
12501259 const char * pcr_error ;
12511260 phar_entry_info * entry ;
12521261 int is_dir ;
12531262
1254- #ifdef PHP_WIN32
1255- phar_unixify_path_separators (path , path_len );
1256- #endif
1257-
12581263 is_dir = (path_len && (path [path_len - 1 ] == '/' )) ? 1 : 0 ;
12591264
12601265 if (error ) {
@@ -1401,6 +1406,19 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, const char *pa
14011406}
14021407/* }}} */
14031408
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+
14041422static const char hexChars [] = "0123456789ABCDEF" ;
14051423
14061424static int phar_hex_str (const char * digest , size_t digest_len , char * * signature ) /* {{{ */
0 commit comments