zval_dtor(&op2);
break;
}
+ case ZEND_AST_GREATER:
+ case ZEND_AST_GREATER_EQUAL:
+ {
+ /* op1 > op2 is the same as op2 < op1 */
+ binary_op_type op = ast->kind == ZEND_AST_GREATER
+ ? is_smaller_function : is_smaller_or_equal_function;
+ zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
+ zend_ast_evaluate(&op2, ast->child[1], scope TSRMLS_CC);
+ op(result, &op2, &op1 TSRMLS_CC);
+ zval_dtor(&op1);
+ zval_dtor(&op2);
+ break;
+ }
case ZEND_BW_NOT:
zend_ast_evaluate(&op1, ast->child[0], scope TSRMLS_CC);
bitwise_not_function(result, &op1 TSRMLS_CC);
zend_bool zend_is_allowed_in_const_expr(zend_ast_kind kind) {
return kind == ZEND_CONST || kind == ZEND_AST_BINARY_OP
+ || kind == ZEND_AST_GREATER || kind == ZEND_AST_GREATER_EQUAL
|| kind == ZEND_AST_AND || kind == ZEND_AST_OR
|| kind == ZEND_BW_NOT || kind == ZEND_BOOL_NOT
|| kind == ZEND_AST_UNARY_PLUS || kind == ZEND_AST_UNARY_MINUS
| expr T_LOGICAL_AND expr
{ $$.u.ast = zend_ast_create_binary(ZEND_AST_AND, $1.u.ast, $3.u.ast); }
| expr T_LOGICAL_XOR expr
- { $$.u.ast = zend_ast_create_binary(ZEND_BOOL_XOR, $1.u.ast, $3.u.ast); }
+ { $$.u.ast = zend_ast_create_binary_op(ZEND_BOOL_XOR, $1.u.ast, $3.u.ast); }
| expr '|' expr { $$.u.ast = zend_ast_create_binary_op(ZEND_BW_OR, $1.u.ast, $3.u.ast); }
| expr '&' expr { $$.u.ast = zend_ast_create_binary_op(ZEND_BW_AND, $1.u.ast, $3.u.ast); }
| expr '^' expr { $$.u.ast = zend_ast_create_binary_op(ZEND_BW_XOR, $1.u.ast, $3.u.ast); }
;
static_scalar: /* compile-time evaluated scalars */
- static_scalar_value { zend_do_constant_expression(&$$, $1.u.ast TSRMLS_CC); }
+ expr { zend_do_constant_expression(&$$, $1.u.ast TSRMLS_CC); }
;
static_scalar_value: