Merge pull request #60 from phptek/issue/58

FIX: Fixes #58 We always want $content (an array) passed to implode()
This commit is contained in:
Robbie Averill 2019-12-16 12:04:39 -08:00 committed by GitHub
commit d0a7db0b68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,16 +109,12 @@ class PDFTextExtractor extends FileTextExtractor
$path = $file instanceof File ? $this->getPathFromFile($file) : $file;
exec(sprintf('%s %s - 2>&1', $this->bin('pdftotext'), escapeshellarg($path)), $content, $err);
if ($err) {
if (!is_array($err) && $err == 1) {
// For Windows compatibility
$err = $content;
}
if ($err) {
throw new Exception(sprintf(
'PDFTextExtractor->getContent() failed for %s: %s',
$path,
implode(PHP_EOL, $err)
implode(PHP_EOL, $content)
));
}