php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #63512
Patch 63512-v3.diff revision 2012-11-15 04:46 UTC by pierrick@php.net
Patch 63512-v2.diff revision 2012-11-15 04:12 UTC by pierrick@php.net

Patch 63512-v3.diff for Filesystem function related Bug #63512

Patch version 2012-11-15 04:46 UTC

Return to Bug #63512 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: pierrick@php.net

diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l
index 8aeb076..2a21e77 100644
--- a/Zend/zend_ini_scanner.l
+++ b/Zend/zend_ini_scanner.l
@@ -347,7 +347,7 @@ DOLLAR_CURLY "${"
 
 SECTION_RAW_CHARS [^\]\n\r]
 SINGLE_QUOTED_CHARS [^']
-RAW_VALUE_CHARS [^"\n\r;\000]
+RAW_VALUE_CHARS [^\n\r;\000]
 
 LITERAL_DOLLAR ("$"([^{\000]|("\\"{ANY_CHAR})))
 VALUE_CHARS         ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR})
@@ -445,33 +445,40 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
 	return '=';
 }
 
-<ST_RAW>["] {
+<ST_RAW>{RAW_VALUE_CHARS} { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
+	char *sc = NULL;
 	while (YYCURSOR < YYLIMIT) {
-		switch (*YYCURSOR++) {
+		switch (*YYCURSOR) {
 			case '\n':
-				SCNG(lineno)++;
-				break;
 			case '\r':
-				if (*YYCURSOR != '\n') {
-					SCNG(lineno)++;
-				}
+				goto end_raw_value_chars;
 				break;
-			case '"':
-				yyleng = YYCURSOR - SCNG(yy_text) - 2;
-				SCNG(yy_text)++;
-				RETURN_TOKEN(TC_RAW, yytext, yyleng);
-			case '\\':
-				if (YYCURSOR < YYLIMIT) {
-					YYCURSOR++;
+			case ';':
+				if (sc == NULL) {
+					sc = YYCURSOR;
 				}
+				/* no break */
+			default:
+				YYCURSOR++;
 				break;
 		}
 	}
+end_raw_value_chars:
 	yyleng = YYCURSOR - SCNG(yy_text);
-	RETURN_TOKEN(TC_RAW, yytext, yyleng);
-}
 
-<ST_RAW>{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
+	/* Eat trailing semicolons */
+	while (yytext[yyleng - 1] == ';') {
+		yyleng--;
+	}
+
+	/* Eat leading and trailing double quotes */
+	if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
+		SCNG(yy_text)++;
+		yyleng = yyleng - 2;
+	} else if (sc) {
+		YYCURSOR = sc;
+		yyleng = YYCURSOR - SCNG(yy_text);
+	}
 	RETURN_TOKEN(TC_RAW, yytext, yyleng);
 }
 
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 19:01:51 2014 UTC