|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75917 SplFileObject::seek broken with CSV flags
Submitted: 2018-02-05 09:40 UTC Modified: 2018-02-05 13:59 UTC
From: nyamsprod at gmail dot com Assigned:
Status: Closed Package: SPL related
PHP Version: Next Minor Version OS: Irrelevant
Private report: No CVE-ID: None
 [2018-02-05 09:40 UTC] nyamsprod at gmail dot com
Prior to PHP7.2.0 SplFileObject::seek would return false if the seeked line did not exists. Since PHP7.2.0 it returns the last line of the file instead.


Test script:

$expected = [
    ['john', 'doe', '', '0123456789'],
    ['jane', 'doe', ''],

$tmp = new SplTempFileObject();
foreach ($expected as $row) {
var_dump($tmp->current()); //expected false
$tmp->setFlags(SplFileObject::READ_CSV | SplFileObject::SKIP_EMPTY);
var_dump($tmp->current());  //expected false (get the last row instead)


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-05 13:59 UTC]
According to `git bisect` the relevant commit is
 [2021-12-06 17:42 UTC]
The following pull request has been associated:

Patch Name: Fix #75917: SplFileObject::seek broken with CSV flags.
On GitHub:
 [2021-12-06 18:05 UTC]
Automatic comment on behalf of Flashwade1990 (author) and cmb69 (committer)
Log: Fix #75917: SplFileObject::seek broken with CSV flags
 [2021-12-06 18:05 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 18:01:30 2024 UTC