diff --git a/src/scripts/darwin.sh b/src/scripts/darwin.sh index 8c18b53e..aee6d5c7 100644 --- a/src/scripts/darwin.sh +++ b/src/scripts/darwin.sh @@ -172,8 +172,9 @@ add_php() { # Function to get extra version. php_extra_version() { - if [[ ${version:?} =~ ${nightly_versions:?} ]]; then - echo " ($(brew cat "$php_formula" | grep -Eo "archive/[0-9a-zA-Z]+" | cut -d'/' -f 2))" + php_formula_file="$tap_dir"/shivammathur/homebrew-php/Formula/php@"$version".rb + if [ -e "$php_formula_file" ] && grep -Eq "archive/[0-9a-zA-Z]+" "$php_formula_file"; then + echo " ($(grep -Eo "archive/[0-9a-zA-Z]+" "$php_formula_file" | cut -d'/' -f 2))" fi } diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index 3f92c156..2b0a0a3c 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -168,7 +168,7 @@ link_pecl_file() { # Function to get extra version. php_extra_version() { - if [[ ${version:?} =~ ${nightly_versions:?} ]]; then + if [ -e /etc/php/"$version"/COMMIT ]; then echo " ($(cat "/etc/php/$version/COMMIT"))" fi }