#45372 [Opn->Ctl]: hash# check in new re2c parser breaks code

From: Date: Fri, 27 Jun 2008 06:03:16 +0000
Subject: #45372 [Opn->Ctl]: hash# check in new re2c parser breaks code
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-126055@lists.php.net to get a copy of this message
 ID:               45372
 Updated by:       alan_k@php.net
 Reported By:      alan_k@php.net
-Status:           Open
+Status:           Critical
 Bug Type:         Scripting Engine problem
 Operating System: linux
 PHP Version:      5.3CVS-2008-06-27 (CVS)
 New Comment:

marking as critical....


Previous Comments:
------------------------------------------------------------------------

[2008-06-27 06:00:54] alan_k@php.net

Description:
------------
single line file:

<?php if (1) { ?>#<?php }  ?>

produces a parse error:

get's caught with this rule from the re2c scanner.
<INITIAL>"#".+ {NEWLINE} {
	if ((YYCTYPE*)yytext == SCNG(yy_start)) {
		/* ignore first line when it's started with a # */
		goto restart;
	} else {
		goto inline_char_handler;
	}
}


basically the scanner runs off the end, and eats everything after the
#

I've fixed it by changing the above to something like:
} else {
        /* shunt back to just return the # on it's own..   */
        YYCURSOR = YYMARKER;
          yyleng = 1;
        goto inline_char_handler;
}









------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45372&edit=1



Thread (10 messages)

« previous php.bugs (#126055) next »