From bcf64cbeefb3701151f33e4bf579592627f61d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Fri, 25 Aug 2023 17:35:14 +0200 Subject: [PATCH] fix: throw if the PHP version doesn't exist --- src/SPC/store/source/PhpSource.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SPC/store/source/PhpSource.php b/src/SPC/store/source/PhpSource.php index f23f63ea..ce7483f6 100644 --- a/src/SPC/store/source/PhpSource.php +++ b/src/SPC/store/source/PhpSource.php @@ -35,6 +35,10 @@ class PhpSource extends CustomSourceBase { // 查找最新的小版本号 $info = json_decode(Downloader::curlExec(url: "https://www.php.net/releases/index.php?json&version={$major_version}"), true); + if (!isset($info['version'])) { + throw new DownloaderException("Version {$major_version} not found."); + } + $version = $info['version']; // 从官网直接下载