Index: zend_language_scanner.l =================================================================== RCS file: /repository/ZendEngine2/zend_language_scanner.l,v retrieving revision 1.131.2.11.2.14 diff -u -r1.131.2.11.2.14 zend_language_scanner.l --- zend_language_scanner.l 22 Mar 2008 18:53:08 -0000 1.131.2.11.2.14 +++ zend_language_scanner.l 8 Apr 2008 11:04:00 -0000 @@ -1919,8 +1919,13 @@ if (yyleng > CG(heredoc_len) && !memcmp(end - CG(heredoc_len), CG(heredoc), CG(heredoc_len))) { int len = yyleng - CG(heredoc_len) - 2; /* 2 for newline before and after label */ - if (len > 0 && yytext[len - 1] == '\r' && yytext[len] == '\n') { - len--; + /* May have matched fooLABEL; make sure there's a newline before it */ + if (yytext[len] != '\n') { + if (yytext[len] != '\r') { + goto wrong_label; + } + } else if (len > 0 && yytext[len - 1] == '\r') { + len--; /* Windows newline */ } /* Go back before last label char, to match in ST_END_HEREDOC state */ @@ -1937,6 +1942,7 @@ } else { /* Go back to end of label, so the next match works correctly in case of * a variable or another label at the beginning of the next line */ +wrong_label: yyless(yyleng - 1); yymore(); }