Skip to content

Commit 9e2841d

Browse files
committed
ext/phar: reorganize if branches as content is identical
Just check in advance if we don't have an archive to checkin in the manifest cache.
1 parent 37d9689 commit 9e2841d

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

ext/phar/util.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,18 +1088,13 @@ zend_result phar_get_archive(phar_archive_data **archive, const char *fname, siz
10881088
}
10891089

10901090
fd_ptr = zend_hash_str_find_ptr(&(PHAR_G(phar_alias_map)), fname, fname_len);
1091-
if (fd_ptr) {
1092-
fd = *archive = fd_ptr;
1093-
1094-
PHAR_G(last_phar) = fd;
1095-
PHAR_G(last_phar_name) = fd->fname;
1096-
PHAR_G(last_alias) = fd->alias;
1097-
PHAR_G(last_alias_len) = fd->alias_len;
10981091

1099-
return SUCCESS;
1092+
/* If we didn't find the fname in the alias map, check in the cached manifest to see if we can find it */
1093+
if (!fd_ptr && PHAR_G(manifest_cached)) {
1094+
fd_ptr = zend_hash_str_find_ptr(&cached_alias, fname, fname_len);
11001095
}
11011096

1102-
if (PHAR_G(manifest_cached) && NULL != (fd_ptr = zend_hash_str_find_ptr(&cached_alias, fname, fname_len))) {
1097+
if (fd_ptr) {
11031098
fd = *archive = fd_ptr;
11041099

11051100
PHAR_G(last_phar) = fd;

0 commit comments

Comments
 (0)