From cdf04b13a9e4895aa45ecc70906f59a843c8a25b Mon Sep 17 00:00:00 2001 From: Jani Taskinen Date: Tue, 4 Aug 2009 02:34:04 +0000 Subject: [PATCH] - Fixed bug #49056 (parse_ini_file() regression in 5.3.0 when using non-ASCII strings as option keys) --- Zend/zend_ini_scanner.l | 15 +++++++---- .../tests/general_functions/bug49056.phpt | 26 +++++++++++++++++++ 2 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 ext/standard/tests/general_functions/bug49056.phpt diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index ff1bf3f909..ac1ac76ac2 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -298,7 +298,6 @@ restart: goto restart; } } - /*!re2c re2c:yyfill:check = 0; LNUM [0-9]+ @@ -309,7 +308,7 @@ NEWLINE ("\r"|"\n"|"\r\n") TABS_AND_SPACES [ \t] WHITESPACE [ \t]+ CONSTANT [a-zA-Z][a-zA-Z0-9_]* -LABEL [a-zA-Z0-9*._-]* +LABEL [^=\n\r\t ;|&$~(){}!"\[]+ TOKENS [:,.\[\]"'()|^&+-/*=%$!~<>?@{}] OPERATORS [&|~()!] DOLLAR_CURLY "${" @@ -318,13 +317,12 @@ SECTION_RAW_CHARS [^\]\n\r] SINGLE_QUOTED_CHARS [^'] RAW_VALUE_CHARS [^=\n\r;] -/* Allow using ${foobar} in sections, quoted strings and values */ 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 ([^$"\\]|("\\"[^"])|{LITERAL_DOLLAR}|"\\"["][^\r\n]) -+ := yyleng = YYCURSOR - SCNG(yy_text); + := yyleng = YYCURSOR - SCNG(yy_text); "[" { /* Section start */ /* Enter section data lookup state */ @@ -489,7 +487,14 @@ DOUBLE_QUOTES_CHARS ([^$"\\]|("\\"[^"])|{LITERAL_DOLLAR}|"\\"["][^\r\n]) return END_OF_LINE; } -[^] { /* End of option value (if EOF is reached before EOL) */ +{TABS_AND_SPACES}*[#][^\r\n]*{NEWLINE} { /* #Comment */ + zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno)); + BEGIN(INITIAL); + SCNG(lineno)++; + return END_OF_LINE; +} + +[^] { /* End of option value (if EOF is reached before EOL */ BEGIN(INITIAL); return END_OF_LINE; } diff --git a/ext/standard/tests/general_functions/bug49056.phpt b/ext/standard/tests/general_functions/bug49056.phpt new file mode 100644 index 0000000000..454c1944f1 --- /dev/null +++ b/ext/standard/tests/general_functions/bug49056.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #49056 (parse_ini_*() regression in 5.3.0 when using non-ASCII strings as option keys) +--FILE-- + +--CLEAN-- + +--EXPECT-- +array(2) { + [u"Cooking_furniture"]=> + unicode(19) "Küchen Möbel (en)" + [u"Küchen_Möbel"]=> + unicode(22) "Cooking furniture (en)" +} -- 2.40.0