From ddb6e5792207dbc214257657c9e229416e037cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Thu, 27 May 2021 15:21:39 +0200 Subject: [PATCH 1/2] Add a few missing RETURN_THROWS(); Only PharFileInfo::compress() really needs it though. --- ext/phar/phar_object.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 5fe9e26af0b92..6ef45270579b1 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -4544,8 +4544,8 @@ PHP_METHOD(PharFileInfo, isCompressed) case PHAR_ENT_COMPRESSED_BZ2: RETURN_BOOL(entry_obj->entry->flags & PHAR_ENT_COMPRESSED_BZ2); default: - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \ - "Unknown compression type specified"); \ + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unknown compression type specified"); + RETURN_THROWS(); } } /* }}} */ @@ -4568,8 +4568,8 @@ PHP_METHOD(PharFileInfo, getCRC32) if (entry_obj->entry->is_crc_checked) { RETURN_LONG(entry_obj->entry->crc32); } else { - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \ - "Phar entry was not CRC checked"); \ + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Phar entry was not CRC checked"); + RETURN_THROWS(); } } /* }}} */ @@ -4957,8 +4957,8 @@ PHP_METHOD(PharFileInfo, compress) entry_obj->entry->flags |= PHAR_ENT_COMPRESSED_BZ2; break; default: - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \ - "Unknown compression type specified"); \ + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unknown compression type specified"); + RETURN_THROWS(); } entry_obj->entry->phar->is_modified = 1; From 8934a1f61ccb53282605e9890ec204761ac8cf74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Thu, 27 May 2021 15:25:25 +0200 Subject: [PATCH 2/2] Fix a few ext/phar return types --- ext/phar/phar_object.stub.php | 10 ++++++---- ext/phar/phar_object_arginfo.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ext/phar/phar_object.stub.php b/ext/phar/phar_object.stub.php index 5a1122c74ffce..9daa37e465595 100644 --- a/ext/phar/phar_object.stub.php +++ b/ext/phar/phar_object.stub.php @@ -42,7 +42,7 @@ public function decompress(?string $extension = null) {} /** @return Phar|null */ public function convertToExecutable(?int $format = null, ?int $compression = null, ?string $extension = null) {} - /** @return Phar|null */ + /** @return PharData|null */ public function convertToData(?int $format = null, ?int $compression = null, ?string $extension = null) {} /** @return bool */ @@ -229,14 +229,16 @@ public function compressFiles(int $compression) {} public function decompressFiles() {} /** - * @return Phar|null + * @return PharData|null * @implementation-alias Phar::compress + * @no-verify */ public function compress(int $compression, ?string $extension = null) {} /** - * @return Phar|null + * @return PharData|null * @implementation-alias Phar::decompress + * @no-verify */ public function decompress(?string $extension = null) {} @@ -247,7 +249,7 @@ public function decompress(?string $extension = null) {} public function convertToExecutable(?int $format = null, ?int $compression = null, ?string $extension = null) {} /** - * @return Phar|null + * @return PharData|null * @implementation-alias Phar::convertToData */ public function convertToData(?int $format = null, ?int $compression = null, ?string $extension = null) {} diff --git a/ext/phar/phar_object_arginfo.h b/ext/phar/phar_object_arginfo.h index ade8f874abae9..e9db1e7d3227b 100644 --- a/ext/phar/phar_object_arginfo.h +++ b/ext/phar/phar_object_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a8562e63010e127aadb97134733ac328ced3c7bf */ + * Stub hash: 0973430f90bd972380a9c4434808e9857f703548 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)