From 6b53144fcb24af77093d4150dd7d0dd571f25761 Mon Sep 17 00:00:00 2001 From: Patryk Date: Fri, 1 Mar 2024 10:51:10 +0100 Subject: [PATCH] Fix returning empty text in some cases (#666) Co-authored-by: Konrad Abicht --- src/Smalot/PdfParser/PDFObject.php | 2 +- src/Smalot/PdfParser/RawData/RawDataParser.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Smalot/PdfParser/PDFObject.php b/src/Smalot/PdfParser/PDFObject.php index 8d1d14de..69e2120b 100644 --- a/src/Smalot/PdfParser/PDFObject.php +++ b/src/Smalot/PdfParser/PDFObject.php @@ -689,7 +689,7 @@ public function getTextArray(?Page $page = null): array $xobject = $page->getXObject($id); // @todo $xobject could be a ElementXRef object, which would then throw an error - if (\is_object($xobject) && $xobject instanceof self && !\in_array($xobject->getUniqueId(), self::$recursionStack)) { + if (\is_object($xobject) && $xobject instanceof self && !\in_array($xobject->getUniqueId(), self::$recursionStack, true)) { // Not a circular reference. $text[] = $xobject->getText($page); } diff --git a/src/Smalot/PdfParser/RawData/RawDataParser.php b/src/Smalot/PdfParser/RawData/RawDataParser.php index 6b04fae5..3d746caf 100644 --- a/src/Smalot/PdfParser/RawData/RawDataParser.php +++ b/src/Smalot/PdfParser/RawData/RawDataParser.php @@ -127,7 +127,7 @@ protected function decodeStream(string $pdfData, array $xref, array $sdic, strin // decode the stream $remaining_filters = []; foreach ($filters as $filter) { - if (\in_array($filter, $this->filterHelper->getAvailableFilters())) { + if (\in_array($filter, $this->filterHelper->getAvailableFilters(), true)) { try { $stream = $this->filterHelper->decodeFilter($filter, $stream, $this->config->getDecodeMemoryLimit()); } catch (\Exception $e) {