diff --git a/composer.json b/composer.json index 462cf8d..36eb05b 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,8 @@ "ext-mbstring": "*", "symfony/console": "^3.4", "symfony/debug": "^3.4", - "symfony/yaml": "^3.4" + "symfony/yaml": "^3.4", + "symfony/process": "^5.0" }, "bin": ["bin/logchecker"] } diff --git a/composer.lock b/composer.lock index 9ea2423..8256ea6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9ad854c65da76498f6a2af058812e332", + "content-hash": "bda3c6cb822164941a9e71f909c7468a", "packages": [ { "name": "psr/log", @@ -298,6 +298,55 @@ ], "time": "2019-02-06T07:57:58+00:00" }, + { + "name": "symfony/process", + "version": "v5.0.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "fd4a86dd7e36437f2fc080d8c42c7415d828a0a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/fd4a86dd7e36437f2fc080d8c42c7415d828a0a8", + "reference": "fd4a86dd7e36437f2fc080d8c42c7415d828a0a8", + "shasum": "" + }, + "require": { + "php": "^7.2.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2020-02-08T17:00:58+00:00" + }, { "name": "symfony/yaml", "version": "v3.4.28", diff --git a/src/Logchecker.php b/src/Logchecker.php index 6b1436c..21261dd 100644 --- a/src/Logchecker.php +++ b/src/Logchecker.php @@ -2,6 +2,7 @@ namespace OrpheusNET\Logchecker; +use Symfony\Component\Process\Process; use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Exception\ParseException; @@ -466,7 +467,10 @@ class Logchecker { } if (Util::commandExists($Command)) { - $Out = shell_exec("{$Command} ".escapeshellarg($this->LogPath)); + $process = new Process([$Command, $this->LogPath]); + $process->run(); + $Out = $process->getOutput(); + if ($Out == null || Util::strposArray($Out, $BadStrings) !== false || strpos($Out, $GoodString) === false) { $this->Checksum = false; }