From 208196eeb609cc46fb5900635d4f265f5b7ae8f8 Mon Sep 17 00:00:00 2001 From: Patryk Wilusz Date: Fri, 12 Jan 2024 11:57:18 +0100 Subject: [PATCH] Fix returning empty text in some cases --- 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 6e24064d..6b4243b1 100644 --- a/src/Smalot/PdfParser/PDFObject.php +++ b/src/Smalot/PdfParser/PDFObject.php @@ -690,7 +690,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 8f8c15dc..cfb8cf1d 100644 --- a/src/Smalot/PdfParser/RawData/RawDataParser.php +++ b/src/Smalot/PdfParser/RawData/RawDataParser.php @@ -125,7 +125,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) {