Skip to content
Snippets Groups Projects
Commit 56694239 authored by pancho's avatar pancho Committed by Liam Morland
Browse files

Issue #1866174 by Pancho: Validate pdftk binary

parent 6f745255
No related branches found
No related tags found
No related merge requests found
...@@ -30,13 +30,11 @@ class FillPdf { ...@@ -30,13 +30,11 @@ class FillPdf {
if (empty($pdftk_path)) { if (empty($pdftk_path)) {
$pdftk_path = 'pdftk'; $pdftk_path = 'pdftk';
} }
$process = new Process($pdftk_path); $process = new Process($pdftk_path . ' --version');
$process->run(); $process->run();
if (in_array($process->getExitCode(), [126, 127], TRUE)) { // Check there's no error code and the --version output includes "pdftk".
return FALSE; return !in_array($process->getExitCode(), [126, 127], TRUE) && strpos($process->getOutput(), 'pdftk') !== FALSE;
}
return TRUE;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment