[web-downloads] main: Handle failure in ->extractTo
| From: | Shivam Mathur | Date: | Mon, 12 Aug 2024 01:55:51 +0000 |
| Subject: | [web-downloads] main: Handle failure in ->extractTo | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-31937@lists.php.net to get a copy of this message | ||
Author: Shivam Mathur (shivammathur)
Date: 2024-08-12T07:22:27+05:30
Commit: https://github.com/php/web-downloads/commit/fc616242a31b4068fb7e169f83e4ab49bd7b9adb
Raw diff: https://github.com/php/web-downloads/commit/fc616242a31b4068fb7e169f83e4ab49bd7b9adb.diff
Handle failure in ->extractTo
Changed paths:
M src/PeclHandler.php
Diff:
diff --git a/src/PeclHandler.php b/src/PeclHandler.php
index fa114cf..125b65f 100644
--- a/src/PeclHandler.php
+++ b/src/PeclHandler.php
@@ -60,7 +60,9 @@ private function fetchExtension(string $extension, string $ref, string $url, str
$zip = new ZipArchive();
if ($zip->open($filepath) === TRUE) {
- $zip->extractTo($destinationDirectory);
+ if($zip->extractTo($destinationDirectory) === FALSE) {
+ throw new Exception('Failed to extract the extension build');
+ }
$zip->close();
} else {
throw new Exception('Failed to extract the extension');