From c4f6fe50454a03f554e19820b6e2b0e4855e611d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Sat, 9 Jun 2018 13:58:09 +0100 Subject: [PATCH] Ensure PHP-Scoper can only be called from the CLI --- bin/php-scoper | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/php-scoper b/bin/php-scoper index 01e8b258..8d8b286c 100755 --- a/bin/php-scoper +++ b/bin/php-scoper @@ -17,6 +17,12 @@ use Isolated\Symfony\Component\Finder\Finder as IsolatedFinder; use RuntimeException; use Symfony\Component\Finder\Finder; +if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') { + echo PHP_EOL.'PHP-Scoper may only be invoked from a command line'.\PHP_EOL; + + exit(1); +} + $findAutoload = function () { if (file_exists($autoload = __DIR__.'/../../../autoload.php')) { // Is installed via composer