diff --git a/src/Document/Object/Item/UncompressedObject/UncompressedObject.php b/src/Document/Object/Item/UncompressedObject/UncompressedObject.php index 513bc4a..db15ca5 100644 --- a/src/Document/Object/Item/UncompressedObject/UncompressedObject.php +++ b/src/Document/Object/Item/UncompressedObject/UncompressedObject.php @@ -100,7 +100,8 @@ public function getEncryptionContext(): ?EncryptionContext { public function getContent(Document $document): Stream { if (($startStreamPos = $document->stream->getStartNextLineAfter(Marker::STREAM, $this->startOffset, $this->endOffset)) !== null && ($endStreamPos = $document->stream->lastPos(Marker::END_STREAM, $document->stream->getSizeInBytes() - $this->endOffset)) !== null) { - if ($startStreamPos === $endStreamPos) { + if ($startStreamPos === $endStreamPos + || $startStreamPos === ($eolEndStreamPos = $document->stream->getEndOfCurrentLine($endStreamPos - 1, $this->endOffset))) { return new InMemoryStream(''); } @@ -108,8 +109,7 @@ public function getContent(Document $document): Stream { $this->getEncryptionContext(), $document, $startStreamPos, - ($document->stream->getEndOfCurrentLine($endStreamPos - 1, $this->endOffset) - ?? throw new ParseFailureException(sprintf('Unable to locate marker %s', WhitespaceCharacter::LINE_FEED->value))) - $startStreamPos, + ($eolEndStreamPos ?? throw new ParseFailureException(sprintf('Unable to locate marker %s', WhitespaceCharacter::LINE_FEED->value))) - $startStreamPos, $this->getDictionary($document), ); }