diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 71d40c116..8423fd2ad 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -741,6 +741,9 @@ EXT_CHECKS; \$issues = array(); ${requiredPhp}${requiredExtensions} if (\$issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } if (!ini_get('display_errors')) { if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, \$issues) . PHP_EOL.PHP_EOL); diff --git a/tests/Composer/Test/Autoload/Fixtures/platform/no_extensions_required.php b/tests/Composer/Test/Autoload/Fixtures/platform/no_extensions_required.php index 762b670af..589e9e770 100644 --- a/tests/Composer/Test/Autoload/Fixtures/platform/no_extensions_required.php +++ b/tests/Composer/Test/Autoload/Fixtures/platform/no_extensions_required.php @@ -9,6 +9,9 @@ if (!(PHP_VERSION_ID >= 70200)) { } if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } if (!ini_get('display_errors')) { if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); diff --git a/tests/Composer/Test/Autoload/Fixtures/platform/no_php_required.php b/tests/Composer/Test/Autoload/Fixtures/platform/no_php_required.php index 0665633cd..a48283c46 100644 --- a/tests/Composer/Test/Autoload/Fixtures/platform/no_php_required.php +++ b/tests/Composer/Test/Autoload/Fixtures/platform/no_php_required.php @@ -13,6 +13,9 @@ if ($missingExtensions) { } if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } if (!ini_get('display_errors')) { if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); diff --git a/tests/Composer/Test/Autoload/Fixtures/platform/no_php_upper_bound.php b/tests/Composer/Test/Autoload/Fixtures/platform/no_php_upper_bound.php index 762b670af..589e9e770 100644 --- a/tests/Composer/Test/Autoload/Fixtures/platform/no_php_upper_bound.php +++ b/tests/Composer/Test/Autoload/Fixtures/platform/no_php_upper_bound.php @@ -9,6 +9,9 @@ if (!(PHP_VERSION_ID >= 70200)) { } if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } if (!ini_get('display_errors')) { if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); diff --git a/tests/Composer/Test/Autoload/Fixtures/platform/replaced_provided_exts.php b/tests/Composer/Test/Autoload/Fixtures/platform/replaced_provided_exts.php index 78b550268..6447885f1 100644 --- a/tests/Composer/Test/Autoload/Fixtures/platform/replaced_provided_exts.php +++ b/tests/Composer/Test/Autoload/Fixtures/platform/replaced_provided_exts.php @@ -12,6 +12,9 @@ if ($missingExtensions) { } if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } if (!ini_get('display_errors')) { if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); diff --git a/tests/Composer/Test/Autoload/Fixtures/platform/specific_php_release.php b/tests/Composer/Test/Autoload/Fixtures/platform/specific_php_release.php index 9ae604c1c..65492e89c 100644 --- a/tests/Composer/Test/Autoload/Fixtures/platform/specific_php_release.php +++ b/tests/Composer/Test/Autoload/Fixtures/platform/specific_php_release.php @@ -9,6 +9,9 @@ if (!(PHP_VERSION_ID >= 70208)) { } if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } if (!ini_get('display_errors')) { if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); diff --git a/tests/Composer/Test/Autoload/Fixtures/platform/typical.php b/tests/Composer/Test/Autoload/Fixtures/platform/typical.php index 9319e33bd..9a11efd36 100644 --- a/tests/Composer/Test/Autoload/Fixtures/platform/typical.php +++ b/tests/Composer/Test/Autoload/Fixtures/platform/typical.php @@ -17,6 +17,9 @@ if ($missingExtensions) { } if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } if (!ini_get('display_errors')) { if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);