Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added XOR support for expressions in INI parser #311

Closed
wants to merge 1 commit into from

4 participants

@p-h-p p-h-p referenced this pull request
Closed

Removed XOR from php.ini #310

@lstrojny

Looks good. Could you squash your commits?

@p-h-p

@lstrojny Squashed. Thank you.

@php-pulls
Collaborator

Comment on behalf of lstrojny at php.net:

Merged into 5.5 and master. Thanks!

@php-pulls php-pulls closed this
@p-h-p

@lstrojny NEWS file wasn't updated http://diffchecker.com/d6jbqi09, could you do it please?

@lstrojny

Is available in NEWS in 5.5 only.

@p-h-p

@lstrojny Figured it out afterwards. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 27, 2013
  1. @p-h-p
This page is out of date. Refresh to see the latest.
View
6 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; }
View
8 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);
View
10 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
View
10 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
Something went wrong with that request. Please try again.