Edit report at https://bugs.php.net/bug.php?id=65600&edit=1
ID: 65600 Updated by: requi...@php.net Reported by: kentaro at ranvis dot com Summary: SplFileObject->next() not move next without current() -Status: Open +Status: Verified Type: Bug Package: SPL related -Operating System: Windows +Operating System: * PHP Version: 5.5.3 Block user comment: N Private report: N New Comment: Using the READ_AHEAD flag will enable the behavior you're expecting. I don't know if that requirement is intentional or necessary. Previous Comments: ------------------------------------------------------------------------ [2013-09-01 10:09:37] kentaro at ranvis dot com Description: ------------ SplFileObject->next() doesn't move to the next line unless ->current() is called in advance. Test script: --------------- $f = new SplFileObject('php://memory', 'r+'); $f->fwrite("line 1\nline 2\nline 3"); $f->rewind(); assert('$f->current() === "line 1\n"'); $f->next(); assert('$f->current() === "line 2\n"'); $f->next(); var_dump($f->ftell()); // 14 assert('$f->current() === "line 3"'); $f->rewind(); $f->next(); $f->next(); var_dump($f->ftell()); // 0 assert('$f->current() === "line 3"'); // fails ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65600&edit=1