OutOfLinebreaksException: Linebreaks for Loader.php exhausted. die() has been disabled for your convenience.
This is a very specific one, so I imagine no one can actually relate, but it was gleeful amounts of utter, raw despair for me, hence sharing:
The Story
The PHP Parser is a robust creature that rarely hiccups.
Except when it does.
This is a once-in-a-lifetime occurrence. Apparently I have two lives, because I've observed it getting its knickers in a twist twice now. Let me tell you about the second time.
PHP usually ignores indentation whitespace and blank lines between code blocks - but somehow, when we were updating Zend 1.9.7 to 1.10.3, half our PHP Unit tests broke. I made a copy of the offending file (Loader.php in Zend's autoloading sublibrary), placed the old code in, commented the new code out and was about to sequentially comment back in to find the core of the error when I noticed it was still happening.
The only difference was in comments. I didn't even want to believe it, so I asked two other people to look at the diff and find the programmatic difference for me. They confirmed a lack thereof. I still felt my sanity slowly leaving me.
- I checked the file with a hex editor.
No broken UTF-8 characters. Well-formed through-out.
Suddenly it worked again. Cue first manic, despair-driven cackling!
To cut a long story short, I 'narrowed it down' to the amount of linebreaks in the file (without the help of die()
which didn't quite want to work in that file anymore). The old file would break just the same if you put more that ~two more linebreaks into it.
To cut to the chase: To this day we don't know what caused it. Suhosin patch? No. xdebug? No. Suhosin extension? No. PHP core? Apparently no, except that's the only thing left to 'explain' it. (Same PHP version on Ubuntu/Kubuntu/CentOS was showing the error, but it wasn't doing it on OpenSUSE; we're not sure if it was the OS or their respective package doing it.)
Our project internal wiki documented the mess and this is (paraphrased) the 'Solution' section:
Depending on your definition of 'solution':
- There is none
- Zend 1.10.4
So we had the Exception on our Whiteboard for a while. Much amusement ensued.
The term
Whenever a parser of an interpreted language hiccups, for whatever reason, and elements of the source file that should not matter suddenly do, despite well-formed syntax and no broken characters, any observed changes in logic are to be considered the result of an OutOfLinebreaksException.
(Even if it has nothing to do with linebreaks in that particular parser-tripping-over-itself case.)