I had some weirdness with the __LINE__ constant reporting the incorrect line. A colleague helped me get to the bottom of it.

There were too many line endings in the file. The only way to “see” them was in vi. They appeared as ^M characters.

The solution, replace them with nothing. I’m certain there are other ways, but this worked for me.

:%s/^M//g

To get the ^M you need to Ctrl+v then Ctrl+m.

Thanks superspace!