The problem endup being an issue with file_get_contents() on the clientraw.txt file. If file_get_contents() fails, it returns FALSE. So several times a day I would get this condition but it wasn't trapped.
The following line would return data from clientraw.txt when it works. If there was a problem $dataraw contained "FALSE", not the data I expect.
$dataraw = file_get_contents($data_file_path);
I just added a line after it:
if ($dataraw == false) {return false;}