mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-10-22 11:06:00 +02:00
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:
commit
d0a7db0b68
@ -109,16 +109,12 @@ class PDFTextExtractor extends FileTextExtractor
|
|||||||
|
|
||||||
$path = $file instanceof File ? $this->getPathFromFile($file) : $file;
|
$path = $file instanceof File ? $this->getPathFromFile($file) : $file;
|
||||||
exec(sprintf('%s %s - 2>&1', $this->bin('pdftotext'), escapeshellarg($path)), $content, $err);
|
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(
|
throw new Exception(sprintf(
|
||||||
'PDFTextExtractor->getContent() failed for %s: %s',
|
'PDFTextExtractor->getContent() failed for %s: %s',
|
||||||
$path,
|
$path,
|
||||||
implode(PHP_EOL, $err)
|
implode(PHP_EOL, $content)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user