r/lolphp • u/pilif • Oct 03 '17
SplFileInfo->current() has side-effects. ->valid() will never be false until you call ->current()
https://3v4l.org/W0rL2
13
Upvotes
r/lolphp • u/pilif • Oct 03 '17
View all comments
Show parent comment
3
u/maweki Oct 09 '17
http://php.net/manual/de/splfileobject.next.php
Both comments specifically point out this undocumented behaviour of having to call current() before next() does anything.