Skip to content

Commit

Permalink
Fix returning empty text in some cases (#666)
Browse files Browse the repository at this point in the history
Co-authored-by: Konrad Abicht <[email protected]>
  • Loading branch information
xAzoom and k00ni authored Mar 1, 2024
1 parent ddf03ea commit 6b53144
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Smalot/PdfParser/PDFObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Smalot/PdfParser/RawData/RawDataParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6b53144

Please sign in to comment.