Fix fetching extension version from PECL on macOS

This commit is contained in:
Shivam Mathur 2020-11-25 05:32:15 +05:30
parent 4ec398d39a
commit 19b09596c6
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -128,9 +128,9 @@ get_pecl_version() {
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
pecl_rest='https://pecl.php.net/rest/r/'
response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
pecl_version=$(echo "$response" | grep -m 1 -Pio "(\d*\.\d*\.\d*$stability\d*)")
pecl_version=$(echo "$response" | grep -m 1 -Eio "([0-9]+\.[0-9]+\.[0-9]+${stability}[0-9]+)")
if [ ! "$pecl_version" ]; then
pecl_version=$(echo "$response" | grep -m 1 -Po "(\d*\.\d*\.\d*)")
pecl_version=$(echo "$response" | grep -m 1 -Eo "([0-9]+\.[0-9]+\.[0-9]+)")
fi
echo "$pecl_version"
}