Skip to content

Commit 9c325d2

Browse files
committed
fix logi
1 parent 99a92dc commit 9c325d2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

ext/phar/phar.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,16 +505,19 @@ static zend_result phar_open_parsed_phar(char *fname, size_t fname_len, char *al
505505
}
506506
#endif
507507
zend_result archive_retrieved = phar_get_archive(&phar, fname, fname_len, alias, alias_len, error);
508+
/* logic is as follows:
509+
- If no alias was passed in, then it can match either and be valid
510+
- If an explicit alias was requested, ensure the filename passed in matches the phar's filename.
511+
*/
512+
bool process_phar = SUCCESS == archive_retrieved && (!alias || zend_string_equals_cstr(phar->fname, fname, fname_len));
508513
#ifdef PHP_WIN32
509514
if (fname != save_fname) {
510515
free_alloca(fname, fname_use_heap);
511516
fname = save_fname;
512517
}
513518
#endif
514519

515-
if (SUCCESS == archive_retrieved
516-
&& ((alias && zend_string_equals_cstr(phar->fname, fname, fname_len)) || !alias)
517-
) {
520+
if (process_phar) {
518521
/* logic above is as follows:
519522
If an explicit alias was requested, ensure the filename passed in
520523
matches the phar's filename.

0 commit comments

Comments
 (0)