Skip to content

Commit

Permalink
Use known ranges when defaulting to a PHP version
Browse files Browse the repository at this point in the history
This is useful e.g. for testing branches in parallel, or when running against custom repositories that might receive unexpected updates.
  • Loading branch information
dzuelke committed Dec 7, 2023
1 parent 12f015a commit b8fb9be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ composer validate --no-plugins --no-check-publish --no-check-all --quiet "$COMPO
status "Preparing platform package installation..."

if [[ $STACK == "heroku-20" ]]; then
HEROKU_PHP_DEFAULT_RUNTIME_VERSION="^7.3.0 | ^8.0.0"
HEROKU_PHP_DEFAULT_RUNTIME_VERSION="^7.3.0 | ^8.0.0 <8.3"
else
HEROKU_PHP_DEFAULT_RUNTIME_VERSION="^8.0.0"
HEROKU_PHP_DEFAULT_RUNTIME_VERSION="^8.0.0 <8.3"
fi
export HEROKU_PHP_DEFAULT_RUNTIME_VERSION
# extract requirements from composer.lock
Expand Down
2 changes: 1 addition & 1 deletion bin/util/platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function mkmetas($package, array &$metapaks, &$have_runtime_req = false) {
// we can't compute a resulting version rule (that's the whole point of the custom installer that uses Composer's solver), so throwing an error is the best thing we can do here
exit(3);
}
file_put_contents("php://stderr", "\033[1;33mNOTICE:\033[0m No runtime required in $COMPOSER_LOCK; using PHP ". ($require["heroku-sys/php"] = getenv("HEROKU_PHP_DEFAULT_RUNTIME_VERSION") ?: "^7.0.0") . "\n");
file_put_contents("php://stderr", "\033[1;33mNOTICE:\033[0m No runtime required in $COMPOSER_LOCK; using PHP ". ($require["heroku-sys/php"] = getenv("HEROKU_PHP_DEFAULT_RUNTIME_VERSION") ?: "*") . "\n");
} elseif(!isset($root["require"]["php"])) {
file_put_contents("php://stderr", "\033[1;33mNOTICE:\033[0m No runtime required in $COMPOSER; requirements\nfrom dependencies in $COMPOSER_LOCK will be used for selection\n");
}
Expand Down

0 comments on commit b8fb9be

Please sign in to comment.