Fix SplFileObject::fgets

Aims to fix #3873