From 4e08295cea88be3cb711938be847c3799e601387 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 4 Sep 2024 15:42:16 +0800 Subject: [PATCH] Add patch version support for downloading php-src --- src/SPC/command/DownloadCommand.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/SPC/command/DownloadCommand.php b/src/SPC/command/DownloadCommand.php index 4134d05b..9f217dbf 100644 --- a/src/SPC/command/DownloadCommand.php +++ b/src/SPC/command/DownloadCommand.php @@ -123,10 +123,15 @@ class DownloadCommand extends BaseCommand // Define PHP major version $ver = $this->php_major_ver = $this->getOption('with-php') ?? '8.1'; define('SPC_BUILD_PHP_VERSION', $ver); + // match x.y preg_match('/^\d+\.\d+$/', $ver, $matches); if (!$matches) { - logger()->error("bad version arg: {$ver}, x.y required!"); - return static::FAILURE; + // match x.y.z + preg_match('/^\d+\.\d+\.\d+$/', $ver, $matches); + if (!$matches) { + logger()->error("bad version arg: {$ver}, x.y or x.y.z required!"); + return static::FAILURE; + } } // retry