Skip to content

Commit 411ce53

Browse files
Update version checking in terminus.php
1 parent e231b62 commit 411ce53

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

bin/terminus.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@
1212
// Unset memory limit
1313
ini_set('memory_limit', -1);
1414

15-
if (version_compare(PHP_VERSION, '8.2.0', '<') === true) {
15+
// Look up minimum PHP version from composer.json.
16+
$composer_json_contents = file_get_contents(dirname(__DIR__) . '/composer.json');
17+
$composer_json_data = json_decode($composer_json_contents, true);
18+
$min_php_version = $composer_json_data['config']['platform']['php'];
19+
20+
if (version_compare(PHP_VERSION, $min_php_version, '<') === true) {
1621
fwrite(STDERR, "\n");
1722
fwrite(STDERR, 'Sorry, your PHP version (' . PHP_VERSION . ') is no longer supported.' . "\n");
18-
fwrite(STDERR, 'Upgrade to PHP 8.2 or newer to use Terminus 4. For PHP versions prior to 8.2, downgrade to Terminus 3.x.' . "\n\n");
23+
fwrite(STDERR, 'Upgrade to PHP ' . $min_php_version . ' or newer to use Terminus 4. For prior PHP versions, downgrade to Terminus 3.x.' . "\n\n");
1924
fwrite(STDERR, 'For more information, see https://pantheon.io/docs/terminus/updates#php-version-compatibility-matrix' . "\n\n");
2025
exit(1);
2126
}

composer.lock

Lines changed: 12 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)