@@ -632,18 +632,14 @@ zend_result phar_get_entry_data(phar_entry_data **ret, char *fname, size_t fname
632
632
/**
633
633
* Create a new dummy file slot within a writeable phar for a newly created file
634
634
*/
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 ) /* {{{ */
636
636
{
637
637
phar_archive_data * phar ;
638
638
phar_entry_info * entry , etemp ;
639
639
phar_entry_data * ret ;
640
640
const char * pcr_error ;
641
641
char is_dir ;
642
642
643
- #ifdef PHP_WIN32
644
- phar_unixify_path_separators (path , path_len );
645
- #endif
646
-
647
643
is_dir = (path_len && path [path_len - 1 ] == '/' ) ? 1 : 0 ;
648
644
649
645
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
731
727
}
732
728
/* }}} */
733
729
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
+
734
743
static inline void phar_set_pharfp (phar_archive_data * phar , php_stream * fp )
735
744
{
736
745
if (!phar -> is_persistent ) {
@@ -1245,16 +1254,12 @@ phar_entry_info *phar_get_entry_info(phar_archive_data *phar, const char *path,
1245
1254
* valid pre-existing empty directory entries
1246
1255
*/
1247
1256
// 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 ) /* {{{ */
1249
1258
{
1250
1259
const char * pcr_error ;
1251
1260
phar_entry_info * entry ;
1252
1261
int is_dir ;
1253
1262
1254
- #ifdef PHP_WIN32
1255
- phar_unixify_path_separators (path , path_len );
1256
- #endif
1257
-
1258
1263
is_dir = (path_len && (path [path_len - 1 ] == '/' )) ? 1 : 0 ;
1259
1264
1260
1265
if (error ) {
@@ -1401,6 +1406,19 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, const char *pa
1401
1406
}
1402
1407
/* }}} */
1403
1408
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
+
1404
1422
static const char hexChars [] = "0123456789ABCDEF" ;
1405
1423
1406
1424
static int phar_hex_str (const char * digest , size_t digest_len , char * * signature ) /* {{{ */
0 commit comments