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');