Fix fread call when file size is zero
janmartenjongerius
released this
10 Jul 09:30
·
94 commits
to master
since this release
When the file size is zero, the call to SplFileObject::fread fails,
because it only accepts a size greater than zero.
This has been fixed by testing the size and optionally falling back to
an empty string.
The unit test has been expanded to prevent regression.
Thanks to @chekalskiy for reporting the bug
Thanks to @willemstuursma for offering an alternate fix