summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index babf39ff40..ee3aa75ad1 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2109,7 +2109,8 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t
zend_compile_expr(&prop_node, prop_ast TSRMLS_CC);
opline = zend_delayed_emit_op(result, ZEND_FETCH_OBJ_R, &obj_node, &prop_node TSRMLS_CC);
- if (opline->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline->op2.constant)) == IS_STRING) {
+ if (opline->op2_type == IS_CONST) {
+ convert_to_string(&CONSTANT(opline->op2.constant));
zend_alloc_polymorphic_cache_slot(opline->op2.constant TSRMLS_CC);
}
@@ -2477,7 +2478,12 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc TSRMLS_DC) /* {{{ *
if (fbc) {
flags |= ZEND_ARG_COMPILE_TIME_BOUND;
}
- opline->extended_value = flags;
+ if ((flags & ZEND_ARG_COMPILE_TIME_BOUND) && !(flags & ZEND_ARG_SEND_BY_REF)) {
+ opline->opcode = ZEND_SEND_VAR;
+ opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND;
+ } else {
+ opline->extended_value = flags;
+ }
} else if (fbc) {
opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND;
}
@@ -2984,9 +2990,7 @@ void zend_compile_global_var(zend_ast *ast TSRMLS_DC) /* {{{ */
zend_compile_expr(&name_node, name_ast TSRMLS_CC);
if (name_node.op_type == IS_CONST) {
- if (Z_TYPE(name_node.u.constant) != IS_STRING) {
- convert_to_string(&name_node.u.constant);
- }
+ convert_to_string(&name_node.u.constant);
}
if (zend_try_compile_cv(&result, var_ast TSRMLS_CC) == SUCCESS) {
@@ -3827,11 +3831,15 @@ void zend_compile_params(zend_ast *ast TSRMLS_DC) /* {{{ */
arg_info->class_name_len = 0;
if (type_ast) {
- zend_bool has_null_default = default_ast
- && (Z_TYPE(default_node.u.constant) == IS_NULL
- || (Z_TYPE(default_node.u.constant) == IS_CONSTANT
- && strcasecmp(Z_STRVAL(default_node.u.constant), "NULL") == 0)
- || Z_TYPE(default_node.u.constant) == IS_CONSTANT_AST); // ???
+ zend_bool has_null_default = 0;
+
+ if (default_ast) {
+ if (!(has_null_default = (Z_TYPE(default_node.u.constant) == IS_NULL || (Z_TYPE(default_node.u.constant) == IS_CONSTANT && strcasecmp(Z_STRVAL(default_node.u.constant), "NULL") == 0)))) {
+ if (Z_OPT_CONSTANT(default_node.u.constant)) {
+ has_null_default = 2;
+ }
+ }
+ }
op_array->fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
arg_info->allow_null = has_null_default;
@@ -5469,7 +5477,7 @@ void zend_compile_isset_or_empty(znode *result, zend_ast *ast TSRMLS_DC) /* {{{
zend_ast *var_ast = ast->child[0];
znode var_node;
- zend_op *opline;
+ zend_op *opline = NULL;
ZEND_ASSERT(ast->kind == ZEND_AST_ISSET || ast->kind == ZEND_AST_EMPTY);