Skip to content

Commit 9c90e16

Browse files
authored
phar: Avoid an error goto in phar_zip_flush() (#20233)
1 parent a69b353 commit 9c90e16

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

ext/phar/zip.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,8 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 4) void phar_zip_flush(phar_archive_data *phar, z
13921392
zend_hash_apply_with_argument(&phar->manifest, phar_zip_changed_apply, (void *) &pass);
13931393

13941394
phar_metadata_tracker_try_ensure_has_serialized_data(&phar->metadata_tracker, phar->is_persistent);
1395-
if (pass_error) {
1396-
has_pass_error:
1395+
if (pass_error
1396+
|| FAILURE == phar_zip_applysignature(phar, &pass)) {
13971397
spprintf(error, 4096, "phar zip flush of \"%s\" failed: %s", phar->fname, pass_error);
13981398
efree(pass_error);
13991399
nopasserror:
@@ -1406,11 +1406,6 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 4) void phar_zip_flush(phar_archive_data *phar, z
14061406
return;
14071407
}
14081408

1409-
if (FAILURE == phar_zip_applysignature(phar, &pass)) {
1410-
ZEND_ASSERT(pass_error != NULL);
1411-
goto has_pass_error;
1412-
}
1413-
14141409
/* save zip */
14151410
cdir_size = php_stream_tell(pass.centralfp);
14161411
cdir_offset = php_stream_tell(pass.filefp);

0 commit comments

Comments
 (0)