xref: /plugin/upgrade/myvendor/composer/platform_check.php (revision ab8e5256dbaece2751c4414d6cf7b761cb71998a)
1*ab8e5256SAndreas Gohr<?php
2*ab8e5256SAndreas Gohr
3*ab8e5256SAndreas Gohr// platform_check.php @generated by Composer
4*ab8e5256SAndreas Gohr
5*ab8e5256SAndreas Gohr$issues = array();
6*ab8e5256SAndreas Gohr
7*ab8e5256SAndreas Gohrif (!(PHP_VERSION_ID >= 70000)) {
8*ab8e5256SAndreas Gohr    $issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.0". You are running ' . PHP_VERSION . '.';
9*ab8e5256SAndreas Gohr}
10*ab8e5256SAndreas Gohr
11*ab8e5256SAndreas Gohrif ($issues) {
12*ab8e5256SAndreas Gohr    if (!headers_sent()) {
13*ab8e5256SAndreas Gohr        header('HTTP/1.1 500 Internal Server Error');
14*ab8e5256SAndreas Gohr    }
15*ab8e5256SAndreas Gohr    if (!ini_get('display_errors')) {
16*ab8e5256SAndreas Gohr        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
17*ab8e5256SAndreas Gohr            fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
18*ab8e5256SAndreas Gohr        } elseif (!headers_sent()) {
19*ab8e5256SAndreas Gohr            echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
20*ab8e5256SAndreas Gohr        }
21*ab8e5256SAndreas Gohr    }
22*ab8e5256SAndreas Gohr    throw new \RuntimeException(
23*ab8e5256SAndreas Gohr        'Composer detected issues in your platform: ' . implode(' ', $issues)
24*ab8e5256SAndreas Gohr    );
25*ab8e5256SAndreas Gohr}
26