SplFileObject method seek doesn't work as expected
Description
The following code:
<?php
$splFileObject = new SplFileObject('any.csv');
$splFileObject->setFlags(
SplFileObject::READ_CSV
| SplFileObject::READ_AHEAD
| SplFileObject::SKIP_EMPTY
| SplFileObject::DROP_NEW_LINE
);
$splFileObject->seek(0);
$splFileObject->key(); // 0 Returns as expected
$splFileObject->seek(1);
$splFileObject->key(); // 1 Returns as expected
$splFileObject->seek(2);
$splFileObject->key(); // 1 But if we give anything more than 1, it will return 1
Resulted in this output:
Seek doesn't get you to the expected line, but instead gets you to the second one (1).
But I expected this output instead:
Seek will move to the expected lines that exists.
seek works fine for PHP 7.4 and PHP 8.1, but results in this error for PHP 8.0
PHP Version
PHP 8.0.16
Operating System
Ubuntu 20.04
I cannot reproduce with PHP 8.0.17-dev. This is likely a duplicate of #8121.
Thank you, I will test it tomorrow using PHP 8.0.17
Sorry, couldn't test it yesterday, so writing it today. Tried testing it with current available PHP 8.0.17, but unfortunately didn't help, I think the next patch version will include the fix, as the latest one you tested was dev version, right?
Oh, right, the fix should be in 8.0.18RC1.