From 5ff91b875e1aef57dd5197b4d59a50d709be85ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Sat, 9 Jun 2018 14:11:06 +0100 Subject: [PATCH] Ensure PHP-Scoper can only be called from the CLI (#220) --- 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