cvs: ZendEngine2 / zend_language_scanner.l /tests bug36513.phpt
| From: | Dmitry Stogov | Date: | Thu, 13 Apr 2006 13:48:40 +0000 |
| Subject: | cvs: ZendEngine2 / zend_language_scanner.l /tests bug36513.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4812@lists.php.net to get a copy of this message | ||
dmitry Thu Apr 13 13:48:40 2006 UTC
Modified files:
/ZendEngine2 zend_language_scanner.l
/ZendEngine2/tests bug36513.phpt
Log:
Fixed bug #36513 (comment will be outputed in last line)
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_language_scanner.l?r1=1.151&r2=1.152&diff_format=u
Index: ZendEngine2/zend_language_scanner.l
diff -u ZendEngine2/zend_language_scanner.l:1.151 ZendEngine2/zend_language_scanner.l:1.152
--- ZendEngine2/zend_language_scanner.l:1.151 Thu Mar 23 21:54:00 2006
+++ ZendEngine2/zend_language_scanner.l Thu Apr 13 13:48:40 2006
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_language_scanner.l,v 1.151 2006/03/23 21:54:00 andrei Exp $ */
+/* $Id: zend_language_scanner.l,v 1.152 2006/04/13 13:48:40 dmitry Exp $ */
#define yyleng SCNG(yy_leng)
#define yytext SCNG(yy_text)
@@ -2107,7 +2107,7 @@
yymore();
}
-<ST_ONE_LINE_COMMENT>[^\n\r?%>]+{ANY_CHAR} {
+<ST_ONE_LINE_COMMENT>[^\n\r?%>]*{ANY_CHAR} {
switch (yytext[yyleng-1]) {
case '?': case '%': case '>':
yyless(yyleng-1);
@@ -2137,7 +2137,7 @@
<ST_ONE_LINE_COMMENT>"?>"|"%>" {
if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */
Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */
- Z_STRLEN_P(zendlval) = yyleng;
+ Z_STRLEN_P(zendlval) = yyleng-2;
Z_TYPE_P(zendlval) = IS_STRING;
yyless(yyleng-2);
BEGIN(ST_IN_SCRIPTING);
http://cvs.php.net/viewcvs.cgi/ZendEngine2/tests/bug36513.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug36513.phpt
diff -u /dev/null ZendEngine2/tests/bug36513.phpt:1.2
--- /dev/null Thu Apr 13 13:48:40 2006
+++ ZendEngine2/tests/bug36513.phpt Thu Apr 13 13:48:40 2006
@@ -0,0 +1,22 @@
+--TEST--
+Bug #36513 (comment will be outputed in last line)
+--FILE--
+<?php
+function test($s) {
+ echo "'".trim(str_replace(" ", " ",
htmlspecialchars_decode(strip_tags(highlight_string($s,1)))))."'\n";
+}
+
+eval('echo "1";//2');
+eval('echo 3; //{ 4?>5');
+echo "\n";
+
+//test('<?php echo "1";//');
+test('<?php echo "1";//2');
+test('<?php echo "1";//22');
+test('<?php echo 3; // 4 ?>5');
+?>
+--EXPECT--
+135
+'<?php echo "1";//2'
+'<?php echo "1";//22'
+'<?php echo 3; // 4 ?>5'