note 98132 deleted from function.halt-compiler by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: Shyru 

----

As reported in http://bugs.php.net/bug.php?id=48930 there is a Bug in PHP >=5.3 when using __halt_compiler() in php-files that have a shebang (for example: #/usr/bin/php) at the top of the file so that it is executable. The shebang is not correctly considered in __COMPILER_HALT_OFFSET_, and so the offset is wrong. In PHP 5.2.x this worked fine.
This is just a heads-up so that people encountering strange issues with it have a chance to see it. (I had to search a while and scratch my head to find the issue).

The workaround we implemented, is to look at the first batch of bytes after the offset, and if they contain parts of __halt_compiler() the offset ist wrong. You may then correct the offset by the length of the shebang you use. Using this way the code works in PHP 5.2 and 5.3, even if the Bug gets fixed someday in the future.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.