Commit: 05016b7e960148b0d2d5bde279c22e05bc42d518 Author: Dejan Marjanovic <dejan.marjano...@gmail.com> Tue, 26 Mar 2013 23:54:09 +0100 Committer: Lars Strojny <lstro...@php.net> Wed, 27 Mar 2013 21:28:53 +0100 Parents: 6e8aa096964e1d723a9cae3572b2f0affa4e53c0 Branches: PHP-5.5
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=05016b7e960148b0d2d5bde279c22e05bc42d518 Log: Added XOR support for expressions in INI parser Changed paths: M Zend/zend_ini_parser.y M Zend/zend_ini_scanner.l A tests/func/011.phpt A tests/func/bug64523.phpt Diff: diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y index 2d428c3..901baba 100644 --- a/Zend/zend_ini_parser.y +++ b/Zend/zend_ini_parser.y @@ -67,6 +67,9 @@ static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2) case '&': i_result = i_op1 & i_op2; break; + case '^': + i_result = i_op1 ^ i_op2; + break; case '~': i_result = ~i_op1; break; @@ -264,7 +267,7 @@ ZEND_API int zend_parse_ini_string(char *str, zend_bool unbuffered_errors, int s %token BOOL_FALSE %token END_OF_LINE %token '=' ':' ',' '.' '"' '\'' '^' '+' '-' '/' '*' '%' '$' '~' '<' '>' '?' '@' '{' '}' -%left '|' '&' +%left '|' '&' '^' %right '~' '!' %% @@ -348,6 +351,7 @@ expr: var_string_list { $$ = $1; } | expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); } | expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); } + | expr '^' expr { zend_ini_do_op('^', &$$, &$1, &$3); } | '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); } | '!' expr { zend_ini_do_op('!', &$$, &$2, NULL); } | '(' expr ')' { $$ = $2; } diff --git a/Zend/zend_ini_scanner.l b/Zend/zend_ini_scanner.l index 5fb28d4..92fb08f 100644 --- a/Zend/zend_ini_scanner.l +++ b/Zend/zend_ini_scanner.l @@ -340,9 +340,9 @@ NEWLINE ("\r"|"\n"|"\r\n") TABS_AND_SPACES [ \t] WHITESPACE [ \t]+ CONSTANT [a-zA-Z_][a-zA-Z0-9_]* -LABEL [^=\n\r\t;|&$~(){}!"\[]+ -TOKENS [:,.\[\]"'()|^&+-/*=%$!~<>?@{}] -OPERATORS [&|~()!] +LABEL [^=\n\r\t;&|^$~(){}!"\[]+ +TOKENS [:,.\[\]"'()&|^+-/*=%$!~<>?@{}] +OPERATORS [&|^~()!] DOLLAR_CURLY "${" SECTION_RAW_CHARS [^\]\n\r] @@ -350,7 +350,7 @@ SINGLE_QUOTED_CHARS [^'] RAW_VALUE_CHARS [^\n\r;\000] LITERAL_DOLLAR ("$"([^{\000]|("\\"{ANY_CHAR}))) -VALUE_CHARS ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR}) +VALUE_CHARS ([^$= \t\n\r;&|^~()!"'\000]|{LITERAL_DOLLAR}) SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR}) <!*> := yyleng = YYCURSOR - SCNG(yy_text); diff --git a/tests/func/011.phpt b/tests/func/011.phpt new file mode 100644 index 0000000..ec93214 --- /dev/null +++ b/tests/func/011.phpt @@ -0,0 +1,10 @@ +--TEST-- +Test bitwise AND, OR, XOR, NOT and logical NOT in INI via error_reporting +--INI-- +error_reporting = E_ALL & E_NOTICE | E_STRICT ^ E_DEPRECATED & ~E_WARNING | !E_ERROR +--FILE-- +<?php +echo ini_get('error_reporting'); +?> +--EXPECT-- +10248 diff --git a/tests/func/bug64523.phpt b/tests/func/bug64523.phpt new file mode 100644 index 0000000..e0092ad --- /dev/null +++ b/tests/func/bug64523.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #64523: XOR not parsed in INI +--INI-- +error_reporting = E_ALL ^ E_NOTICE ^ E_STRICT ^ E_DEPRECATED +--FILE-- +<?php +echo ini_get('error_reporting'); +?> +--EXPECTF-- +22519 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php