jani Fri, 07 Aug 2009 14:21:38 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=286908
Log: - Fixed bug #48660 (parse_ini_*(): dollar sign as last character of value fails) Bug: http://bugs.php.net/48660 (Assigned) parse_ini_*(): dollar sign as last character of value fails Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l U php/php-src/trunk/Zend/zend_ini_scanner.l U php/php-src/trunk/ext/standard/tests/general_functions/bug48660.phpt
Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2009-08-07 13:31:09 UTC (rev 286907) +++ php/php-src/branches/PHP_5_3/NEWS 2009-08-07 14:21:38 UTC (rev 286908) @@ -12,8 +12,8 @@ - Fixed bug #49132 (posix_times returns false without error). (phpbugs at gunnu dot us) - Fixed bug #49125 (Error in dba_exists C code). (jdornan at stanford dot edu) -- Fixed bug #49122 (undefined reference to mysqlnd_stmt_next_result on compile with - --with-mysqli and MySQL 6.0). (Jani) +- Fixed bug #49122 (undefined reference to mysqlnd_stmt_next_result on compile + with --with-mysqli and MySQL 6.0). (Jani) - Fixed bug #49095 (proc_get_status['exitcode'] fails on win32). (Felipe) - Fixed bug #49092 (ReflectionFunction fails to work with functions in fully qualified namespaces). (Kalle, Jani) @@ -38,8 +38,8 @@ (Greg) - Fixed bug #49018 (phar tar stores long filenames wit prefix/name reversed). (Greg) -- Fixed bug #49014 (dechunked filter broken when serving more than 8192 bytes in - a chunk). (andreas dot streichardt at globalpark dot com, Ilia) +- Fixed bug #49014 (dechunked filter broken when serving more than 8192 bytes + in a chunk). (andreas dot streichardt at globalpark dot com, Ilia) - Fixed bug #49000 (PHP CLI in Interactive mode (php -a) crashes when including files from function). (Stas) - Fixed bug #48994 (zlib.output_compression does not ouput HTTP headers when @@ -74,14 +74,16 @@ gmail dot com, Pierre) - Fixed bug #48762 (IPv6 address filter still rejects valid address). (Felipe) - Fixed bug #48757 (ReflectionFunction::invoke() parameter issues). (Kalle) -- Fixed bug #48740 (PHAR install fails when INSTALL_ROOT is not the final install - location). (james dot cohen at digitalwindow dot com, Greg) +- Fixed bug #48740 (PHAR install fails when INSTALL_ROOT is not the final + install location). (james dot cohen at digitalwindow dot com, Greg) - Fixed bug #48733 (CURLOPT_WRITEHEADER|CURLOPT_FILE|CURLOPT_STDERR warns on files that have been opened with r+). (Ilia) - Fixed bug #48718 (FILTER_VALIDATE_EMAIL does not allow numbers in domain components). (Ilia) - Fixed bug #48681 (openssl signature verification for tar archives broken). (Greg) +- Fixed bug #48660 (parse_ini_*(): dollar sign as last character of value + fails). (Jani) - Fixed bug #48645 (mb_convert_encoding() doesn't understand hexadecimal html-entities). (Moriyoshi) - Fixed bug #48637 ("file" fopen wrapper is overwritten when using @@ -90,8 +92,8 @@ (Jani) - Fixed bug #48400 (imap crashes when closing stream opened with OP_PROTOTYPE flag). (Jani) -- Fixed bug #48377 (error message unclear on converting phar with existing file). - (Greg) +- Fixed bug #48377 (error message unclear on converting phar with existing + file). (Greg) - Fixed bug #48247 (Infinite loop and possible crash during startup with errors when errors are logged). (Jani) - Fixed bug #48189 (ibase_execute error in return param). (Kalle) Modified: php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l =================================================================== --- php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l 2009-08-07 13:31:09 UTC (rev 286907) +++ php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l 2009-08-07 14:21:38 UTC (rev 286908) @@ -54,7 +54,9 @@ #define YYSTATE YYGETCONDITION() #define yytext ((char*)SCNG(yy_text)) #define yyleng SCNG(yy_leng) -#define yyless(x) YYCURSOR = yytext + x +#define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \ + yyleng = (unsigned int)x; } while(0) + /* #define yymore() goto yymore_restart */ /* perform sanity check. If this message is triggered you should @@ -320,7 +322,6 @@ 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); @@ -453,20 +454,47 @@ return '"'; } -<ST_DOUBLE_QUOTES>{DOUBLE_QUOTES_CHARS}+("\\"["])? { /* Escape double quoted string contents */ - if(yyleng > 1 && yytext[yyleng-1] == '"' && yytext[yyleng-2] == '\\') { - yyless(yyleng-1); - yyleng--; +<ST_DOUBLE_QUOTES>["]{TABS_AND_SPACES}* { /* Double quoted '"' string ends */ + yy_pop_state(TSRMLS_C); + return '"'; +} + +<ST_DOUBLE_QUOTES>[^] { /* Escape double quoted string contents */ + if (YYCURSOR > YYLIMIT) { + return 0; } + + while (YYCURSOR < YYLIMIT) { + switch (*YYCURSOR++) { + case '"': + if (YYCURSOR < YYLIMIT && YYCURSOR[-2] == '\\' && *YYCURSOR != '\r' && *YYCURSOR != '\n') { + continue; + } + break; + case '$': + if (*YYCURSOR == '{') { + break; + } + continue; + case '\\': + if (YYCURSOR < YYLIMIT && *YYCURSOR != '"') { + YYCURSOR++; + } + /* fall through */ + default: + continue; + } + + YYCURSOR--; + break; + } + + yyleng = YYCURSOR - SCNG(yy_text); + zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC); return TC_QUOTED_STRING; } -<ST_DOUBLE_QUOTES>["]{TABS_AND_SPACES}* { /* Double quoted '"' string ends */ - yy_pop_state(TSRMLS_C); - return '"'; -} - <ST_SECTION_VALUE,ST_VALUE,ST_OFFSET>{WHITESPACE} { RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); } Modified: php/php-src/trunk/Zend/zend_ini_scanner.l =================================================================== --- php/php-src/trunk/Zend/zend_ini_scanner.l 2009-08-07 13:31:09 UTC (rev 286907) +++ php/php-src/trunk/Zend/zend_ini_scanner.l 2009-08-07 14:21:38 UTC (rev 286908) @@ -54,7 +54,9 @@ #define YYSTATE YYGETCONDITION() #define yytext ((char*)SCNG(yy_text)) #define yyleng SCNG(yy_leng) -#define yyless(x) YYCURSOR = yytext + x +#define yyless(x) do { YYCURSOR = (unsigned char*)yytext + x; \ + yyleng = (unsigned int)x; } while(0) + /* #define yymore() goto yymore_restart */ /* perform sanity check. If this message is triggered you should @@ -320,7 +322,6 @@ 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); @@ -453,20 +454,47 @@ return '"'; } -<ST_DOUBLE_QUOTES>{DOUBLE_QUOTES_CHARS}+("\\"["])? { /* Escape double quoted string contents */ - if(yyleng > 1 && yytext[yyleng-1] == '"' && yytext[yyleng-2] == '\\') { - yyless(yyleng-1); - yyleng--; +<ST_DOUBLE_QUOTES>["]{TABS_AND_SPACES}* { /* Double quoted '"' string ends */ + yy_pop_state(TSRMLS_C); + return '"'; +} + +<ST_DOUBLE_QUOTES>[^] { /* Escape double quoted string contents */ + if (YYCURSOR > YYLIMIT) { + return 0; } + + while (YYCURSOR < YYLIMIT) { + switch (*YYCURSOR++) { + case '"': + if (YYCURSOR < YYLIMIT && YYCURSOR[-2] == '\\' && *YYCURSOR != '\r' && *YYCURSOR != '\n') { + continue; + } + break; + case '$': + if (*YYCURSOR == '{') { + break; + } + continue; + case '\\': + if (YYCURSOR < YYLIMIT && *YYCURSOR != '"') { + YYCURSOR++; + } + /* fall through */ + default: + continue; + } + + YYCURSOR--; + break; + } + + yyleng = YYCURSOR - SCNG(yy_text); + zend_ini_escape_string(ini_lval, yytext, yyleng, '"' TSRMLS_CC); return TC_QUOTED_STRING; } -<ST_DOUBLE_QUOTES>["]{TABS_AND_SPACES}* { /* Double quoted '"' string ends */ - yy_pop_state(TSRMLS_C); - return '"'; -} - <ST_SECTION_VALUE,ST_VALUE,ST_OFFSET>{WHITESPACE} { RETURN_TOKEN(TC_WHITESPACE, yytext, yyleng); } Modified: php/php-src/trunk/ext/standard/tests/general_functions/bug48660.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/general_functions/bug48660.phpt 2009-08-07 13:31:09 UTC (rev 286907) +++ php/php-src/trunk/ext/standard/tests/general_functions/bug48660.phpt 2009-08-07 14:21:38 UTC (rev 286908) @@ -27,32 +27,32 @@ <?php @unlink(dirname(__FILE__) . '/bug48660.tmp'); ?> --EXPECTF-- array(1) { - ["cases"]=> + [u"cases"]=> array(5) { - ["Case.a"]=> - string(6) "avalue" - ["Case.b"]=> - string(12) "$dollar_sign" - ["Case.c"]=> - string(12) "dollar_sign$" - ["Case.d"]=> - string(13) "$dollar_sign$" - ["Case.e"]=> - string(2) "10" + [u"Case.a"]=> + unicode(6) "avalue" + [u"Case.b"]=> + unicode(12) "$dollar_sign" + [u"Case.c"]=> + unicode(12) "dollar_sign$" + [u"Case.d"]=> + unicode(13) "$dollar_sign$" + [u"Case.e"]=> + unicode(2) "10" } } array(1) { - ["cases"]=> + [u"cases"]=> array(5) { - ["Case.a"]=> - string(6) "avalue" - ["Case.b"]=> - string(12) "$dollar_sign" - ["Case.c"]=> - string(12) "dollar_sign$" - ["Case.d"]=> - string(13) "$dollar_sign$" - ["Case.e"]=> - string(2) "10" + [u"Case.a"]=> + unicode(6) "avalue" + [u"Case.b"]=> + unicode(12) "$dollar_sign" + [u"Case.c"]=> + unicode(12) "dollar_sign$" + [u"Case.d"]=> + unicode(13) "$dollar_sign$" + [u"Case.e"]=> + unicode(2) "10" } }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php