Skip to content

PHP8 READ_AHEAD fix #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/CsvReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ public function rewind()
{
$this->file->rewind();
if (null !== $this->headerRowNumber) {
$this->file->seek($this->headerRowNumber + 1);
for ($i = 0; $i <= $this->headerRowNumber; $i++) {
Copy link

@olimination olimination Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand we could simplify the code here based on the PHP issue here: php/php-src#6434

the following should work too:

$this->file->seek($this->headerRowNumber);
$this->file->next();

What do you think @czoIg and @ddeboer ?

I have also created once a patch here: https://github.com/Comvation/csv/tree/fix-php8-csvreader-seek

$this->file->next();
}
}
}

Expand Down