Skip to content

Commit

Permalink
improve patch #279
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Feb 5, 2018
1 parent 2881536 commit 6dba48d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,16 @@ protected function seekRow(int $offset)
$this->document->setCsvControl($this->delimiter, $this->enclosure, $this->escape);
$this->document->rewind();

if ($this->document instanceof Stream || PHP_VERSION_ID < 70200) {
$this->document->seek($offset);
//Workaround for SplFileObject::seek bug in PHP7.2+ see https://bugs.php.net/bug.php?id=75917
if (PHP_VERSION_ID >= 70200 && !$this->document instanceof Stream) {
while ($offset !== $this->document->key() && $this->document->valid()) {
$this->document->next();
}

return $this->document->current();
}

//Workaround for SplFileObject::seek bug in PHP7.2+ see https://bugs.php.net/bug.php?id=75917
while ($offset !== $this->document->key() && $this->document->valid()) {
$this->document->next();
}
$this->document->seek($offset);

return $this->document->current();
}
Expand Down

0 comments on commit 6dba48d

Please sign in to comment.