Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40292 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57564 invoked from network); 5 Sep 2008 21:30:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Sep 2008 21:30:33 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.163 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.163 il-gw1.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.163] ([212.25.124.163:53320] helo=il-gw1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/10-56363-6F4A1C84 for ; Fri, 05 Sep 2008 17:30:31 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by il-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Sat, 6 Sep 2008 00:31:36 +0300 Received: from [192.168.16.110] ([192.168.16.110]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 5 Sep 2008 14:31:10 -0700 Message-ID: <48C1A51D.5030803@zend.com> Date: Fri, 05 Sep 2008 14:31:09 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: PHP Internals List References: <20080904190717.aaz97tz688oogc4c@horde.chinstrap.eu> <48C0488C.9090209@sci.fi> <48C04E6A.2080909@zend.com> In-Reply-To: <48C04E6A.2080909@zend.com> Content-Type: multipart/mixed; boundary="------------020500050505060102020006" X-OriginalArrivalTime: 05 Sep 2008 21:31:10.0416 (UTC) FILETIME=[B6E01D00:01C90F9E] Subject: Re: [PHP-DEV] Re: ini-parsing, double quotes, windows in 5.3 From: stas@zend.com (Stanislav Malyshev) --------------020500050505060102020006 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com --------------020500050505060102020006 Content-Type: text/plain; name="scanner.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="scanner.diff" 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 '"'; } -{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; } --------------020500050505060102020006--