From 79f2498d1f11f7cf892a5f9ef8aa0b6575e56247 Mon Sep 17 00:00:00 2001 From: datagutten Date: Sun, 8 Mar 2020 20:32:49 +0100 Subject: [PATCH] Also use symfony/process for chardet --- src/Chardet.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Chardet.php b/src/Chardet.php index 3a10da7..68cbc4d 100644 --- a/src/Chardet.php +++ b/src/Chardet.php @@ -3,6 +3,7 @@ namespace OrpheusNET\Logchecker; use OrpheusNET\Logchecker\Exception\{FileNotFoundException}; +use Symfony\Component\Process\Process; class Chardet { private $executable = null; @@ -29,8 +30,10 @@ class Chardet { if (!file_exists($filename)) { throw new FileNotFoundException($filename); } + $process = new Process([$this->executable, $filename]); + $process->run(); + $output = $process->getOutput(); - $output = shell_exec($this->executable . " " . escapeshellarg($filename)); // Following regex: // matches[1] - file path // matches[2] - charset