Bug(

Looks like there`s a misspelling.
It comes out if you get large portions of data over network and you have to run fread more then once - on the second time it does not get the left part of the line ($length -= mb_strlen($block)), but it gets the whole line length again ($line + 2).