mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-12-06 09:50:56 +00:00
Use the snapshot minimum for PECL packages without stable releases
This commit is contained in:
@@ -167,8 +167,9 @@ get_pecl_version() {
|
||||
local extension=$1
|
||||
local requested=${2:-stable}
|
||||
local states=("stable" "rc" "preview" "beta" "alpha" "devel" "snapshot")
|
||||
local curl_opts=("${curl_opts[@]}" --fail)
|
||||
local stability major_version response pecl_version pattern
|
||||
response=$(get -s -n "" "https://pecl.php.net/rest/r/$extension/allreleases.xml")
|
||||
response=$(get -s -n "" "https://pecl.php.net/rest/r/$extension/allreleases.xml") || response=
|
||||
if [[ "$requested" =~ ^[0-9] ]]; then
|
||||
# Preserve exact pins and PECL's case-sensitive archive directory names.
|
||||
pecl_version=$(echo "$response" | grep -Fio "<v>$requested</v>" | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1)
|
||||
@@ -176,6 +177,10 @@ get_pecl_version() {
|
||||
return
|
||||
fi
|
||||
requested="$(echo "$requested" | tr '[:upper:]' '[:lower:]')"
|
||||
# Only relax stable when the complete PECL release list contains no stable release.
|
||||
if [[ "$requested" = stable && "$response" = *'<r>'*'</r>'*'</a>'* ]] && ! grep -Fqi '<s>stable</s>' <<< "$response"; then
|
||||
requested=snapshot
|
||||
fi
|
||||
[[ " ${states[*]} " = *" $requested "* ]] || return 0
|
||||
IFS=' ' read -r -a states <<< "$(echo "${states[@]}" | grep -Eo ".*$requested")"
|
||||
stability="$(IFS='|' ; echo "${states[*]}")"
|
||||
|
||||
Reference in New Issue
Block a user