PHP: Undefined constant __COMPILER_HALT_OFFSET__

This notice showed up in a file with __halt_compiler() occasionaly. It took me some time to get the problem… the error came only when I refreshed the page within short time, so after a while I suspected the opcode cache to be the problem. Actually it was related to APC and I found the following bug report:
http://pecl.php.net/bugs/bug.php?id=15788&edit=2

Solution: Upgrade APC or just use other methods to store data than at the end of a PHP script ­čśë