From: Jani Taskinen Date: Mon, 30 Nov 2009 22:38:32 +0000 (+0000) Subject: - Fixed bug #50340 (php.ini parser does not allow spaces in ini keys) X-Git-Tag: php-5.3.2RC1~134 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=19d320ea05c41caf94a4b72bd704e12a9a505479;p=php - Fixed bug #50340 (php.ini parser does not allow spaces in ini keys) --- diff --git a/NEWS b/NEWS index 80e6938515..9c2af91088 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,7 @@ PHP NEWS - Fixed memory leak in extension loading when an error occurs on Windows. (Pierre) +- Fixed bug #50340 (php.ini parser does not allow spaces in ini keys). (Jani) - Fixed bug #50285 (xmlrpc does not preserve keys in encoded indexed arrays). (Felipe) - Fixed bug #50282 (xmlrpc_encode_request() changes object into array in diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index c5627d014b..1ab78290a9 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -105,6 +105,17 @@ ZEND_API ts_rsrc_id ini_scanner_globals_id; ZEND_API zend_ini_scanner_globals ini_scanner_globals; #endif +/* Eat leading whitespace */ +#define EAT_LEADING_WHITESPACE() \ + while (yytext[0]) { \ + if (yytext[0] == ' ' || yytext[0] == '\t') { \ + SCNG(yy_text)++; \ + yyleng--; \ + } else { \ + break; \ + } \ + } + /* Eat trailing whitespace + extra char */ #define EAT_TRAILING_WHITESPACE_EX(ch) \ while (yyleng > 0 && ( \ @@ -326,7 +337,7 @@ NEWLINE ("\r"|"\n"|"\r\n") TABS_AND_SPACES [ \t] WHITESPACE [ \t]+ CONSTANT [a-zA-Z][a-zA-Z0-9_]* -LABEL [^=\n\r\t ;|&$~(){}!"\[]+ +LABEL [^=\n\r\t;|&$~(){}!"\[]+ TOKENS [:,.\[\]"'()|^&+-/*=%$!~<>?@{}] OPERATORS [&|~()!] DOLLAR_CURLY "${" @@ -367,6 +378,9 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR}) } {LABEL}"["{TABS_AND_SPACES}* { /* Start of option with offset */ + /* Eat leading whitespace */ + EAT_LEADING_WHITESPACE(); + /* Eat trailing whitespace and [ */ EAT_TRAILING_WHITESPACE_EX('['); @@ -387,6 +401,12 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR}) } {LABEL} { /* Variable name */ + /* Eat leading whitespace */ + EAT_LEADING_WHITESPACE(); + + /* Eat trailing whitespace */ + EAT_TRAILING_WHITESPACE(); + RETURN_TOKEN(TC_VARNAME, yytext, yyleng); } @@ -404,6 +424,12 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR}) } {LABEL} { /* Get option name */ + /* Eat leading whitespace */ + EAT_LEADING_WHITESPACE(); + + /* Eat trailing whitespace */ + EAT_TRAILING_WHITESPACE(); + RETURN_TOKEN(TC_LABEL, yytext, yyleng); }