[php-src] PR #21679: Fix GH-8562: SplFileObject::current() returns wrong value after next()
| From: | iliaal | Date: | Wed, 08 Apr 2026 22:52:54 +0000 |
| Subject: | [php-src] PR #21679: Fix GH-8562: SplFileObject::current() returns wrong value after next() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35628@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21679
Author: iliaal
SplFileObject::next() without READ_AHEAD cleared the cached line and incremented current_line_num
but didn't advance the stream. When called without a preceding current() (e.g. rewind() then
next()), the stream position stayed put, so the subsequent current() read stale data.
The fix reads a line to advance the stream when next() is called with no cached line.
Fixes #8562