From 43f000bf4bad81ee8de8e8dd8b55cfbfd8adaba9 Mon Sep 17 00:00:00 2001 From: Irfan Hardiyanto Date: Mon, 15 Jun 2026 17:01:50 +0700 Subject: [PATCH] fix(windows): pass version arg through to ext install (was using ext name as version) `phpvm ext install [version]` needs four positional args (phpvm, ext, install, name, [version]) but the script's param block only declared three. As a result `phpvm ext install sqlsrv` was calling Install-PECLExt with ($extName="sqlsrv", $requestedVer="sqlsrv"), so the version-probe loop tried URLs like php_sqlsrv-sqlsrv-8.3-nts-vs16-x64.zip and every Test-URLExists returned 404, surfacing as "No compatible package found". This bug was latent in 1.7.0 because Test-URLExists was broken in a way that made every probe false anyway. Once 1.7.1 fixed the redirect handling the arg-shift bug got exposed. Adds a fourth positional `$Arg3`, threads it through the ext dispatcher and Invoke-Ext so the explicit-version path actually receives the version. Verified end-to-end with `phpvm ext install sqlsrv` against PHP 8.3 nts/vs16/x64. Bumps phpvm to 1.7.2. --- linux/install.sh | 2 +- linux/phpvm.sh | 2 +- version.txt | 2 +- windows/install.ps1 | 2 +- windows/phpvm.ps1 | 11 ++++++----- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/linux/install.sh b/linux/install.sh index 7a9c229..84edbba 100644 --- a/linux/install.sh +++ b/linux/install.sh @@ -6,7 +6,7 @@ set -e -PHPVM_VERSION="1.7.1" +PHPVM_VERSION="1.7.2" PHPVM_DIR="${PHPVM_DIR:-$HOME/.phpvm}" PHPVM_REPO="https://raw.githubusercontent.com/devhardiyanto/phpvm/main" diff --git a/linux/phpvm.sh b/linux/phpvm.sh index dd22d95..d5628b9 100644 --- a/linux/phpvm.sh +++ b/linux/phpvm.sh @@ -10,7 +10,7 @@ # phpvm use 8.3.0 # ============================================================================== -PHPVM_VERSION="1.7.1" +PHPVM_VERSION="1.7.2" PHPVM_DIR="${PHPVM_DIR:-$HOME/.phpvm}" PHPVM_VERSIONS="$PHPVM_DIR/versions" PHPVM_CURRENT="$PHPVM_DIR/current" diff --git a/version.txt b/version.txt index 943f9cb..f8a696c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.7.1 +1.7.2 diff --git a/windows/install.ps1 b/windows/install.ps1 index 12565f7..09cfd23 100644 --- a/windows/install.ps1 +++ b/windows/install.ps1 @@ -7,7 +7,7 @@ Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" -$PHPVM_VERSION = "1.7.1" +$PHPVM_VERSION = "1.7.2" $PHPVM_DIR = if ($env:PHPVM_DIR) { $env:PHPVM_DIR } else { "$env:USERPROFILE\.phpvm" } $PHPVM_BIN = "$PHPVM_DIR\bin" diff --git a/windows/phpvm.ps1 b/windows/phpvm.ps1 index 3cf4540..7911268 100644 --- a/windows/phpvm.ps1 +++ b/windows/phpvm.ps1 @@ -7,14 +7,15 @@ param( [Parameter(Position = 0)] [string]$Command = "", [Parameter(Position = 1)] [string]$SubOrVer = "", - [Parameter(Position = 2)] [string]$Arg2 = "" + [Parameter(Position = 2)] [string]$Arg2 = "", + [Parameter(Position = 3)] [string]$Arg3 = "" ) Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" # -- Constants ----------------------------------------------------------------- -$PHPVM_VERSION = "1.7.1" +$PHPVM_VERSION = "1.7.2" $PHPVM_DIR = if ($env:PHPVM_DIR) { $env:PHPVM_DIR } else { "$env:USERPROFILE\.phpvm" } $VERSIONS_DIR = "$PHPVM_DIR\versions" $CURRENT_LINK = "$PHPVM_DIR\current" @@ -1055,7 +1056,7 @@ function Ext-Laravel ([string]$preset = "full") { Write-Host "" } -function Invoke-Ext ([string]$sub, [string]$name) { +function Invoke-Ext ([string]$sub, [string]$name, [string]$ver = "") { switch ($sub.ToLower()) { { $_ -in "list", "ls" } { Ext-List } "loaded" { Ext-Loaded } @@ -1064,7 +1065,7 @@ function Invoke-Ext ([string]$sub, [string]$name) { "install" { if (-not $name) { Write-Err "Usage: phpvm ext install [version]"; return } if ($name.ToLower() -eq "xdebug") { Install-XDebug } - else { Install-PECLExt $name $Arg2 } + else { Install-PECLExt $name $ver } } "info" { if ($name) { Ext-Info $name } else { Write-Err "Usage: phpvm ext info " } } "laravel" { Ext-Laravel $name } @@ -1316,7 +1317,7 @@ if (-not $env:PHPVM_NO_ENTRY) { "which" { Invoke-Which } "ini" { Invoke-Ini } "fix-ini" { Invoke-FixIni } - "ext" { Invoke-Ext $SubOrVer $Arg2 } + "ext" { Invoke-Ext $SubOrVer $Arg2 $Arg3 } "auto" { Invoke-Auto } "hook" { Invoke-Hook $SubOrVer } "composer" { Invoke-Composer }