From 43c0e94ac91e7968670478c5e47bf7edffa52343 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Fri, 9 Apr 1999 11:19:03 +0000 Subject: [PATCH] Honor a semicolon on the same line as an ending token of a heredoc --- Zend/zend-scanner.l | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Zend/zend-scanner.l b/Zend/zend-scanner.l index 03131240d99..3b359dd3b17 100644 --- a/Zend/zend-scanner.l +++ b/Zend/zend-scanner.l @@ -1010,16 +1010,27 @@ TLS_VARS; } -^{LABEL}("\r")?"\n" { +^{LABEL}(";")?("\r")?"\n" { int label_len; + unsigned char unput_semicolon; if (yytext[yyleng-2]=='\r') { label_len = yyleng-2; } else { label_len = yyleng-1; } + + if (yytext[label_len-1]==';') { + label_len--; + unput_semicolon=1; + } else{ + unput_semicolon=0; + } if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) { + if (unput_semicolon) { + unput(';'); + } efree(CG(heredoc)); CG(heredoc)=NULL; CG(heredoc_len)=0;