[php-src] Issue #8562: SplFileObject: current() returns wrong result after call to next()

From: Date: Mon, 16 May 2022 02:26:31 +0000
Subject: [php-src] Issue #8562: SplFileObject: current() returns wrong result after call to next()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241522@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8562 Author: gabrielpl ### Description The following [code](https://3v4l.org/R7iq4): ```php <?php declare(strict_types=1); $file = new SplTempFileObject(); // write to file for ($i = 0; $i < 5; $i++) { $file->fwrite("line {$i}" . PHP_EOL); } $file->rewind(); $file->next(); echo $file->key(), ': ', $file->current(); ``` Resulted in this output: ``` 1: line 0 ``` But I expected this output instead: ``` 1: line 1 ``` ### PHP Version PHP 8.1.6 ### Operating System Windows 11

« previous php.bugs (#241522) next »