Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_3) / zend_language_scanner.c zend_language_scanner.l

[email protected] (Ilia Alshanetsky)
Newsgroups php.zend-engine.cvs
Message-ID <[email protected]>
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 -----
>> iliaa Thu Jan  1 20:16:27 2009 UTC
>>
>> Modified 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;
>
>
> -- 
> Zend Engine CVS Mailing List (http://cvs.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Ilia Alshanetsky
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.