Hi!
Attached is the patch that does the following for php.ini parser:
1. \{LETTER} is literal inside "" now, whatever the letter is
2. \" is " inside "", with exception of:
3. foo="bar\"{NEWLINE} is parsed as bar\ - i.e. \ is allowed before
closing " but only if the line ends there (otherwise it's impossible to
know what the intent was).
That should make Windows paths work just fine (unless you have some
really weird ones that I didn't think about) with double quotes.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED] http://www.zend.com/
(408)253-8829 MSN: [EMAIL PROTECTED]
Index: zend_ini_scanner.l
===================================================================
RCS file: /repository/ZendEngine2/zend_ini_scanner.l,v
retrieving revision 1.41.2.2.2.2.2.10
diff -u -r1.41.2.2.2.2.2.10 zend_ini_scanner.l
--- zend_ini_scanner.l 17 Aug 2008 21:55:26 -0000 1.41.2.2.2.2.2.10
+++ zend_ini_scanner.l 5 Sep 2008 21:24:45 -0000
@@ -244,21 +244,10 @@
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++ = '\\';
@@ -324,7 +313,7 @@
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);
@@ -457,7 +446,11 @@
return '"';
}
-<ST_DOUBLE_QUOTES>{DOUBLE_QUOTES_CHARS}+ { /* Escape double quoted string
contents */
+<ST_DOUBLE_QUOTES>{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;
}
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php