ID: 48930 Updated by: j...@php.net Reported By: adam-phpbugs at adam dot gs -Status: Analyzed +Status: Feedback Bug Type: Scripting Engine problem Operating System: * PHP Version: 5.3.0 Assigned To: scottmac New Comment:
Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Since the shebang check was removed from scanner, isn't this issue solved then? (please try :) Previous Comments: ------------------------------------------------------------------------ [2009-08-30 22:56:02] adam-phpbugs at adam dot gs Understandably this might be a bit hackish to have use a global variable here, but perhaps thats preferable to what i'd consider a major regression? I attempted to patch this so I could just submit a patch here, but unfortunately my c-fu and my understanding of PHP internals is lacking. ------------------------------------------------------------------------ [2009-08-03 03:06:47] scott...@php.net The sapi/cli/php_cli.c code will read forward when it see's a shebang to the next line. The file is already seeked by the time the scanner gets a change to look at it. The zend_get_scanned_file_offset() doesn't know about this because by the time the scanner is started the bytes are already long gone. Short of a global variable I'm not seeing a clean way to fix this. ------------------------------------------------------------------------ [2009-07-16 00:23:45] ka...@php.net Scott, you worked on the re2c switch, any chance you can clarrify this one? ------------------------------------------------------------------------ [2009-07-15 17:40:49] 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]=- [a...@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]=- [a...@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]=- [a...@nighe]$ php test.php __COMPILER_HALT_OFFSET__ is 94 -=[~]=- -=[Wed Jul 15]=- -=[13:37:39]=- [a...@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! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48930&edit=1