From: Stanislav Malyshev Date: Thu, 11 Sep 2008 00:49:18 +0000 (+0000) Subject: MF5: Fix BC issue with ini scanner. X-Git-Tag: BEFORE_HEAD_NS_CHANGE~441 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0eafa6b0807bd4bd2b35d02bfbc233f1f804e877;p=php MF5: Fix BC issue with ini scanner. # Now in "": \LETTER is literal, \" is escaped ", value ending with \" is literal --- diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index b100076862..74ff6ecfa9 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -244,21 +244,10 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty if (*s == '\\') { s++; if (s >= end) { + *t++ = '\\'; continue; } switch (*s) { - case 'n': - *t++ = '\n'; - Z_STRLEN_P(lval)--; - break; - case 'r': - *t++ = '\r'; - Z_STRLEN_P(lval)--; - break; - case 't': - *t++ = '\t'; - Z_STRLEN_P(lval)--; - break; case '"': if (*s != quote_type) { *t++ = '\\'; @@ -325,7 +314,7 @@ RAW_VALUE_CHARS [^=\n\r;] LITERAL_DOLLAR ("$"([^{\000]|("\\"{ANY_CHAR}))) VALUE_CHARS ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR}) SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR}) -DOUBLE_QUOTES_CHARS ([^$"\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR}) +DOUBLE_QUOTES_CHARS ([^$"\\]|("\\"[^"])|{LITERAL_DOLLAR}|"\\"["][^\r\n]) + := yyleng = YYCURSOR - SCNG(yy_text); @@ -458,7 +447,11 @@ DOUBLE_QUOTES_CHARS ([^$"\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR}) return '"'; } -{DOUBLE_QUOTES_CHARS}+ { /* Escape double quoted string contents */ +{DOUBLE_QUOTES_CHARS}+("\\"["])? { /* Escape double quoted string contents */ + if(yyleng > 1 && yytext[yyleng-1] == '"' && yytext[yyleng-2] == '\\') { + yyless(yyleng-1); + yyleng--; + } zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC); return TC_QUOTED_STRING; }