fix: throw if the PHP version doesn't exist

This commit is contained in:
Kévin Dunglas 2023-08-25 17:35:14 +02:00 committed by Jerry Ma
parent dc12d4d982
commit bcf64cbeef

View File

@ -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'];
// 从官网直接下载