Skip to content

Commit

Permalink
Fix returning empty text in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
xAzoom committed Jan 31, 2024
1 parent 4b70df1 commit 208196e
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 @@ -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);
}
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 @@ -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) {
Expand Down

0 comments on commit 208196e

Please sign in to comment.