summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/phar/tests/zip/require_hash.phpt2
-rw-r--r--ext/phar/zip.c11
2 files changed, 4 insertions, 9 deletions
diff --git a/ext/phar/tests/zip/require_hash.phpt b/ext/phar/tests/zip/require_hash.phpt
index 23943550ae..994cc0eb67 100644
--- a/ext/phar/tests/zip/require_hash.phpt
+++ b/ext/phar/tests/zip/require_hash.phpt
@@ -45,7 +45,7 @@ try {
@unlink(__DIR__ . '/require_hash.zip');
?>
--EXPECTF--
-zip-based phar "%srequire_hash.phar.zip" does not have a signature
+phar error: signature is missing in zip-based phar "%srequire_hash.phar.zip"
bool(false)
array(2) {
["hash"]=>
diff --git a/ext/phar/zip.c b/ext/phar/zip.c
index 1b94943ad3..f3aef85cd9 100644
--- a/ext/phar/zip.c
+++ b/ext/phar/zip.c
@@ -665,8 +665,6 @@ foundit:
zend_hash_str_add_mem(&mydata->manifest, entry.filename, entry.filename_len, (void *)&entry, sizeof(phar_entry_info));
}
- mydata->fp = fp;
-
if (zend_hash_str_exists(&(mydata->manifest), ".phar/stub.php", sizeof(".phar/stub.php")-1)) {
mydata->is_data = 0;
} else {
@@ -675,14 +673,11 @@ foundit:
/* ensure signature set */
if (!mydata->is_data && PHAR_G(require_hash) && !mydata->signature) {
- php_stream_close(fp);
- phar_destroy_phar_data(mydata);
- if (error) {
- spprintf(error, 0, "zip-based phar \"%s\" does not have a signature", fname);
- }
- return FAILURE;
+ PHAR_ZIP_FAIL("signature is missing");
}
+ mydata->fp = fp;
+
zend_hash_str_add_ptr(&(PHAR_G(phar_fname_map)), mydata->fname, fname_len, mydata);
if (actual_alias) {