PHP :: Bug #48930 :: __COMPILER_HALT_OFFSET__ incorrect in PHP>=5.3
| Bug #48930 | __COMPILER_HALT_OFFSET__ incorrect in PHP>=5.3 | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2009-07-15 17:40 UTC | Modified: | 2010-06-30 04:46 UTC |
|
||||||||||
| From: | adam-phpbugs at adam dot gs | Assigned: | felipe (profile) | |||||||||||
| Status: | Closed | Package: | Scripting Engine problem | |||||||||||
| PHP Version: | 5.3, 6 | OS: | * | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2009-07-15 17:40 UTC] adam-phpbugs at adam dot gs
Description:
------------
Starting in PHP 5.3.0, php no longer includes the shebang when
calculating the __COMPILER_HALT_OFFSET__.
Reproduce code:
---------------
#!/usr/bin/php
<?php
printf("__COMPILER_HALT_OFFSET__ is %d\n",__COMPILER_HALT_OFFSET__);
__halt_compiler();
Expected result:
----------------
-=[~]=- -=[Wed Jul 15]=- -=[13:35:18]=-
[adam@nighe]$ php -v
PHP 5.3.0 (cli) (built: Jul 7 2009 15:11:49)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
-=[~]=- -=[Wed Jul 15]=- -=[13:35:52]=-
[adam@nighe]$ php-stock -v
PHP 5.2.8 (cli) (built: Feb 5 2009 21:21:13)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
-=[~]=- -=[Wed Jul 15]=- -=[13:37:38]=-
[adam@nighe]$ php test.php
__COMPILER_HALT_OFFSET__ is 94
-=[~]=- -=[Wed Jul 15]=- -=[13:37:39]=-
[adam@nighe]$ php-stock test.php
__COMPILER_HALT_OFFSET__ is 109
The latter answer in this case is correct, the shebang from the above
example is exactly 15 bytes with the newline, 109-15 == 94. So PHP is
not including the shebang in the __COMPILER_HALT_OFFSET__ calculation.
Actual result:
--------------
94!
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2009-07-16 00:23 UTC] kalle@php.net
[2009-08-03 03:06 UTC] scottmac@php.net
[2009-08-30 22:56 UTC] adam-phpbugs at adam dot gs
[2009-09-09 20:02 UTC] jani@php.net
[2010-05-26 11:32 UTC] daniel dot haas at cn-consult dot eu
[2010-06-27 23:46 UTC] felipe@php.net
-Status: Assigned +Status: Closed
[2010-06-27 23:46 UTC] felipe@php.net
[2010-06-27 23:46 UTC] felipe@php.net
-Assigned To: scottmac +Assigned To: felipe
[2010-06-28 00:16 UTC] adam-phpbugs at adam dot gs
[2010-06-28 00:41 UTC] adam-phpbugs at adam dot gs
[2010-06-29 13:54 UTC] felipe@php.net
[2010-06-29 18:44 UTC] adam-phpbugs at adam dot gs
[2010-06-29 18:44 UTC] adam-phpbugs at adam dot gs
[2010-06-29 19:40 UTC] rasmus@php.net
[2010-06-30 04:33 UTC] kalle@php.net
-Status: Closed +Status: Assigned
[2010-06-30 04:46 UTC] felipe@php.net
-Status: Assigned +Status: Closed
[2010-06-30 04:46 UTC] felipe@php.net