Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_3) / zend_language_scanner.c zend_language_scanner.l
| From: | Ilia Alshanetsky | Date: | Thu, 01 Jan 2009 20:46:29 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_3) / zend_language_scanner.c zend_language_scanner.l | ||
| References: | 1 2 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-7284@lists.php.net to get a copy of this message | ||
Nuno,
The original code actually can be found inside php_cli.c and there it only checked the 1st line for '#'. if you create a file such as:
#1
#2
<?php $a = array();
and run it via cli you'll see only #2. The code's intent is to handle #!/path/to/binary, the patch addresses most situations much better then current code. The only alteration I see worth considering (if possible) would be to further check if this is included file or a primary file.
On 1-Jan-09, at 3:28 PM, Nuno Lopes wrote:
This patch doesn't actually fix the bug, just hides it a bit.. If you include a file in php 5.2 that starts with '#!', that text is printed, but not in 5.3. Nuno ----- Original Message -----Ilia Alshanetskyiliaa Thu Jan 1 20:16:27 2009 UTC--Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpModified files: (Branch: PHP_5_3)/ZendEngine2 zend_language_scanner.l zend_language_scanner.c Log: Fixed bug #46844 (php scripts or included files with first line starting with # have the 1st line missed from the output). http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_scanner.l?r1=1.131.2.11.2.13.2.32&r2=1.131.2.11.2.13.2.33&diff_format=u Index: ZendEngine2/zend_language_scanner.l diff -u ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.32 ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.33 --- ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.32 Tue Nov 4 15:58:51 2008 +++ ZendEngine2/zend_language_scanner.l Thu Jan 1 20:16:24 2009 @@ -843,8 +843,8 @@ return 0; } - /* ignore first line when it's started with a # */ - if (YYCURSOR == SCNG(yy_start) && *YYCURSOR == '#') { + /* ignore first line when it's started with a #! */ + if (YYCURSOR == SCNG(yy_start) && *YYCURSOR == '#' && *(YYCURSOR + 1) == '!') { while (++YYCURSOR < YYLIMIT) { if (*YYCURSOR == '\n') { ++YYCURSOR;