From b38c25a13d37243ce170ab5c7d76436c48c1c363 Mon Sep 17 00:00:00 2001 From: itismadness Date: Mon, 17 Dec 2018 10:51:58 -0500 Subject: [PATCH] Fix breaking when spaces in log name (closes #5) --- src/Logchecker.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Logchecker.php b/src/Logchecker.php index e54a868..79f5e36 100644 --- a/src/Logchecker.php +++ b/src/Logchecker.php @@ -439,10 +439,14 @@ class Logchecker { $GoodString = 'OK'; } - $CommandExists = Util::commandExists($Command); - $Out = shell_exec("{$Command} {$this->LogPath}"); - if (Util::strposArray($Out, $BadStrings) !== false || strpos($Out, $GoodString) === false) { - $this->Checksum = false; + if (Util::commandExists($Command)) { + $Out = shell_exec("{$Command} ".escapeshellarg($this->LogPath)); + if ($Out == null || Util::strposArray($Out, $BadStrings) !== false || strpos($Out, $GoodString) === false) { + $this->Checksum = false; + } + } + else { + $this->account("Could not find {$Command}, checksum not validated.", false, false, false, true); } }