}
/* }}} */
-void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar op TSRMLS_DC) /* {{{ */
-{
- zend_op opline;
- zend_op *opline_ptr;
-
- if (varname->op_type == IS_CONST) {
- if (Z_TYPE(varname->u.constant) != IS_STRING) {
- convert_to_string(&varname->u.constant);
- }
-
- if (!zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC) &&
- !(Z_STRLEN(varname->u.constant) == (sizeof("this")-1) &&
- !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1)) &&
- (CG(active_op_array)->last == 0 ||
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE)) {
- result->op_type = IS_CV;
- result->u.op.var = lookup_cv(CG(active_op_array), Z_STR(varname->u.constant) TSRMLS_CC);
- Z_STR(varname->u.constant) = CG(active_op_array)->vars[EX_VAR_TO_NUM(result->u.op.var)];
- result->EA = 0;
- return;
- }
- }
-
- if (bp) {
- opline_ptr = &opline;
- init_op(opline_ptr TSRMLS_CC);
- } else {
- opline_ptr = get_next_op(CG(active_op_array) TSRMLS_CC);
- }
-
- opline_ptr->opcode = op;
- opline_ptr->result_type = IS_VAR;
- opline_ptr->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline_ptr->op1, varname);
- GET_NODE(result, opline_ptr->result);
- SET_UNUSED(opline_ptr->op2);
- opline_ptr->extended_value = ZEND_FETCH_LOCAL;
-
- if (varname->op_type == IS_CONST) {
- if (zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC)) {
- opline_ptr->extended_value = ZEND_FETCH_GLOBAL;
- }
- }
-
- if (bp) {
- zend_llist *fetch_list_ptr = zend_stack_top(&CG(bp_stack));
- zend_llist_add_element(fetch_list_ptr, opline_ptr);
- }
-}
-/* }}} */
-
-void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC) /* {{{ */
-{
- /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */
- fetch_simple_variable_ex(result, varname, bp, ZEND_FETCH_W TSRMLS_CC);
-}
-/* }}} */
-
void zend_do_abstract_method(const znode *function_name, znode *modifiers, const znode *body TSRMLS_DC) /* {{{ */
{
char *method_type;
}
/* }}} */
-static zend_bool opline_is_fetch_this(const zend_op *opline TSRMLS_DC) /* {{{ */
-{
- if ((opline->opcode == ZEND_FETCH_W) && (opline->op1_type == IS_CONST)
- && (Z_TYPE(CONSTANT(opline->op1.constant)) == IS_STRING)
- && ((opline->extended_value & ZEND_FETCH_STATIC_MEMBER) != ZEND_FETCH_STATIC_MEMBER)
- && (Z_STRHASH(CONSTANT(opline->op1.constant)) == THIS_HASHVAL)
- && (Z_STRLEN(CONSTANT(opline->op1.constant)) == (sizeof("this")-1))
- && !memcmp(Z_STRVAL(CONSTANT(opline->op1.constant)), "this", sizeof("this") - 1)) {
- return 1;
- } else {
- return 0;
- }
-}
-/* }}} */
-
-void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC) /* {{{ */
-{
- int last_op_number;
- zend_op *opline;
-
- if (value->op_type == IS_CV) {
- zend_llist *fetch_list_ptr = zend_stack_top(&CG(bp_stack));
- if (fetch_list_ptr && fetch_list_ptr->head) {
- opline = (zend_op *)fetch_list_ptr->head->data;
-
- if (opline->opcode == ZEND_FETCH_DIM_W &&
- opline->op1_type == IS_CV &&
- opline->op1.var == value->u.op.var) {
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_FETCH_R;
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- opline->op1_type = IS_CONST;
- LITERAL_STR(opline->op1,
- STR_COPY(CG(active_op_array)->vars[EX_VAR_TO_NUM(value->u.op.var)]));
- SET_UNUSED(opline->op2);
- opline->extended_value = ZEND_FETCH_LOCAL;
- GET_NODE(value, opline->result);
- }
- }
- }
-
- zend_do_end_variable_parse(variable, BP_VAR_W, 0 TSRMLS_CC);
-
- last_op_number = get_next_op_number(CG(active_op_array));
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- if (variable->op_type == IS_CV) {
- if (variable->u.op.var == CG(active_op_array)->this_var) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
- }
- } else if (variable->op_type == IS_VAR) {
- int n = 0;
-
- while (last_op_number - n > 0) {
- zend_op *last_op;
-
- last_op = &CG(active_op_array)->opcodes[last_op_number-n-1];
-
- if (last_op->result_type == IS_VAR &&
- last_op->result.var == variable->u.op.var) {
- if (last_op->opcode == ZEND_FETCH_OBJ_W) {
- if (n > 0) {
- int opline_no = (opline-CG(active_op_array)->opcodes)/sizeof(*opline);
- *opline = *last_op;
- MAKE_NOP(last_op);
- /* last_op = opline; */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- /* get_next_op can realloc, we need to move last_op */
- last_op = &CG(active_op_array)->opcodes[opline_no];
- }
- last_op->opcode = ZEND_ASSIGN_OBJ;
- zend_do_op_data(opline, value TSRMLS_CC);
- SET_UNUSED(opline->result);
- GET_NODE(result, last_op->result);
- return;
- } else if (last_op->opcode == ZEND_FETCH_DIM_W) {
- if (n > 0) {
- int opline_no = (opline-CG(active_op_array)->opcodes)/sizeof(*opline);
- *opline = *last_op;
- MAKE_NOP(last_op);
- /* last_op = opline; */
- /* TBFixed: this can realloc opcodes, leaving last_op pointing wrong */
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- /* get_next_op can realloc, we need to move last_op */
- last_op = &CG(active_op_array)->opcodes[opline_no];
- }
- last_op->opcode = ZEND_ASSIGN_DIM;
- zend_do_op_data(opline, value TSRMLS_CC);
- opline->op2.var = get_temporary_variable(CG(active_op_array));
- opline->op2_type = IS_VAR;
- SET_UNUSED(opline->result);
- GET_NODE(result, last_op->result);
- return;
- } else if (opline_is_fetch_this(last_op TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
- } else {
- break;
- }
- }
- n++;
- }
- }
-
- opline->opcode = ZEND_ASSIGN;
- SET_NODE(opline->op1, variable);
- SET_NODE(opline->op2, value);
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, opline->result);
-}
-/* }}} */
-
-void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC) /* {{{ */
-{
- zend_op *opline;
-
- if (lvar->op_type == IS_CV) {
- if (lvar->u.op.var == CG(active_op_array)->this_var) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
- }
- } else if (lvar->op_type == IS_VAR) {
- int last_op_number = get_next_op_number(CG(active_op_array));
-
- if (last_op_number > 0) {
- opline = &CG(active_op_array)->opcodes[last_op_number-1];
- if (opline_is_fetch_this(opline TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
- }
- }
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_ASSIGN_REF;
- if (zend_is_function_or_method_call(rvar)) {
- opline->extended_value = ZEND_RETURNS_FUNCTION;
- } else if (rvar->EA & ZEND_PARSED_NEW) {
- opline->extended_value = ZEND_RETURNS_NEW;
- } else {
- opline->extended_value = 0;
- }
- if (result) {
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- GET_NODE(result, opline->result);
- } else {
- opline->result_type = IS_UNUSED | EXT_TYPE_UNUSED;
- }
- SET_NODE(opline->op1, lvar);
- SET_NODE(opline->op2, rvar);
-}
-/* }}} */
-
static inline void do_begin_loop(TSRMLS_D) /* {{{ */
{
zend_brk_cont_element *brk_cont_element;
}
/* }}} */
-void zend_check_writable_variable(const znode *variable) /* {{{ */
-{
- zend_uint type = variable->EA;
-
- if (type & ZEND_PARSED_METHOD_CALL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Can't use method return value in write context");
- }
- if (type == ZEND_PARSED_FUNCTION_CALL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Can't use function return value in write context");
- }
-}
-/* }}} */
-
-void zend_do_begin_variable_parse(TSRMLS_D) /* {{{ */
-{
- zend_llist fetch_list;
-
- zend_llist_init(&fetch_list, sizeof(zend_op), NULL, 0);
- zend_stack_push(&CG(bp_stack), (void *) &fetch_list);
-}
-/* }}} */
-
-void zend_do_end_variable_parse(znode *variable, int type, int arg_offset TSRMLS_DC) /* {{{ */
-{
- zend_llist *fetch_list_ptr = zend_stack_top(&CG(bp_stack));
- zend_llist_element *le = fetch_list_ptr->head;
- zend_op *opline = NULL;
- zend_op *opline_ptr;
- zend_uint this_var = -1;
-
- /* TODO: $foo->x->y->z = 1 should fetch "x" and "y" for R or RW, not just W */
-
- if (le) {
- opline_ptr = (zend_op *)le->data;
- if (opline_is_fetch_this(opline_ptr TSRMLS_CC)) {
- /* convert to FETCH_?(this) into IS_CV */
- if (CG(active_op_array)->last == 0 ||
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE) {
-
- this_var = opline_ptr->result.var;
- if (CG(active_op_array)->this_var == -1) {
- CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), Z_STR(CONSTANT(opline_ptr->op1.constant)) TSRMLS_CC);
- ZVAL_UNDEF(&CONSTANT(opline_ptr->op1.constant));
- } else {
- zend_del_literal(CG(active_op_array), opline_ptr->op1.constant);
- }
- le = le->next;
- if (variable->op_type == IS_VAR &&
- variable->u.op.var == this_var) {
- variable->op_type = IS_CV;
- variable->u.op.var = CG(active_op_array)->this_var;
- }
- } else if (CG(active_op_array)->this_var == -1) {
- CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), STR_INIT("this", sizeof("this")-1, 0) TSRMLS_CC);
- }
- }
-
- while (le) {
- opline_ptr = (zend_op *)le->data;
- if (opline_ptr->opcode == ZEND_SEPARATE) {
- if (type != BP_VAR_R && type != BP_VAR_IS) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- memcpy(opline, opline_ptr, sizeof(zend_op));
- }
- le = le->next;
- continue;
- }
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- memcpy(opline, opline_ptr, sizeof(zend_op));
- if (opline->op1_type == IS_VAR &&
- opline->op1.var == this_var) {
- opline->op1_type = IS_CV;
- opline->op1.var = CG(active_op_array)->this_var;
- }
- if (opline->opcode != ZEND_FETCH_W
- && (opline->op1_type == IS_TMP_VAR || opline->op1_type == IS_CONST)
- && (type != BP_VAR_R && type != BP_VAR_IS && type != BP_VAR_FUNC_ARG)
- ) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "Cannot use temporary expression in write context");
- }
- switch (type) {
- case BP_VAR_R:
- if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2_type == IS_UNUSED) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
- }
- opline->opcode -= 3;
- break;
- case BP_VAR_W:
- break;
- case BP_VAR_RW:
- opline->opcode += 3;
- break;
- case BP_VAR_IS:
- if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2_type == IS_UNUSED) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
- }
- opline->opcode += 6; /* 3+3 */
- break;
- case BP_VAR_FUNC_ARG:
- opline->opcode += 9; /* 3+3+3 */
- opline->extended_value |= arg_offset;
- break;
- case BP_VAR_UNSET:
- if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2_type == IS_UNUSED) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for unsetting");
- }
- opline->opcode += 12; /* 3+3+3+3 */
- break;
- }
- le = le->next;
- }
- if (opline && type == BP_VAR_W && arg_offset) {
- opline->extended_value |= ZEND_FETCH_MAKE_REF;
- }
- }
- zend_llist_destroy(fetch_list_ptr);
- zend_stack_del_top(&CG(bp_stack));
-}
-/* }}} */
-
void zend_do_free(znode *op1 TSRMLS_DC) /* {{{ */
{
if (op1->op_type==IS_TMP_VAR) {
}
/* }}} */
-void zend_do_begin_lambda_function_declaration(znode *result, znode *function_token, int return_reference, int is_static TSRMLS_DC) /* {{{ */
-{
- znode function_name;
- zend_op_array *current_op_array = CG(active_op_array);
- int current_op_number = get_next_op_number(CG(active_op_array));
- zend_op *current_op;
-
- function_name.op_type = IS_CONST;
- ZVAL_STRINGL(&function_name.u.constant, "{closure}", sizeof("{closure}")-1);
-
- zend_do_begin_function_declaration(function_token, &function_name, 0, return_reference, NULL TSRMLS_CC);
-
- result->op_type = IS_TMP_VAR;
- result->u.op.var = get_temporary_variable(current_op_array);
-
- current_op = ¤t_op_array->opcodes[current_op_number];
- current_op->opcode = ZEND_DECLARE_LAMBDA_FUNCTION;
- zend_del_literal(current_op_array, current_op->op2.constant);
- SET_UNUSED(current_op->op2);
- SET_NODE(current_op->result, result);
- if (is_static) {
- CG(active_op_array)->fn_flags |= ZEND_ACC_STATIC;
- }
- CG(active_op_array)->fn_flags |= ZEND_ACC_CLOSURE;
-}
-/* }}} */
-
void zend_do_handle_exception(TSRMLS_D) /* {{{ */
{
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
}
/* }}} */
-void zend_do_receive_param(zend_uchar op, znode *varname, znode *initialization, znode *class_type, zend_uchar pass_by_reference, zend_bool is_variadic TSRMLS_DC) /* {{{ */
-{
- zend_op *opline;
- zend_arg_info *cur_arg_info;
- znode var;
-
- if (zend_is_auto_global(Z_STR(varname->u.constant) TSRMLS_CC)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign auto-global variable %s", Z_STRVAL(varname->u.constant));
- } else {
- var.op_type = IS_CV;
- var.u.op.var = lookup_cv(CG(active_op_array), Z_STR(varname->u.constant) TSRMLS_CC);
- Z_STR(varname->u.constant) = CG(active_op_array)->vars[EX_VAR_TO_NUM(var.u.op.var)];
- var.EA = 0;
- if (Z_STRHASH(varname->u.constant) == THIS_HASHVAL &&
- Z_STRLEN(varname->u.constant) == sizeof("this")-1 &&
- !memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this")-1)) {
- if (CG(active_op_array)->scope &&
- (CG(active_op_array)->fn_flags & ZEND_ACC_STATIC) == 0) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
- }
- CG(active_op_array)->this_var = var.u.op.var;
- }
- }
-
- if (CG(active_op_array)->fn_flags & ZEND_ACC_VARIADIC) {
- zend_error_noreturn(E_COMPILE_ERROR, "Only the last parameter can be variadic");
- }
-
- if (is_variadic) {
- if (op == ZEND_RECV_INIT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Variadic parameter cannot have a default value");
- }
-
- op = ZEND_RECV_VARIADIC;
- CG(active_op_array)->fn_flags |= ZEND_ACC_VARIADIC;
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- CG(active_op_array)->num_args++;
- opline->opcode = op;
- SET_NODE(opline->result, &var);
- opline->op1_type = IS_UNUSED;
- opline->op1.num = CG(active_op_array)->num_args;
- if (op == ZEND_RECV_INIT) {
- SET_NODE(opline->op2, initialization);
- } else {
- SET_UNUSED(opline->op2);
- if (!is_variadic) {
- CG(active_op_array)->required_num_args = CG(active_op_array)->num_args;
- }
- }
- CG(active_op_array)->arg_info = erealloc(CG(active_op_array)->arg_info, sizeof(zend_arg_info)*(CG(active_op_array)->num_args));
- cur_arg_info = &CG(active_op_array)->arg_info[CG(active_op_array)->num_args-1];
- cur_arg_info->name = estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant));
- cur_arg_info->name_len = Z_STRLEN(varname->u.constant);
- cur_arg_info->type_hint = 0;
- cur_arg_info->pass_by_reference = pass_by_reference;
- cur_arg_info->allow_null = 1;
- cur_arg_info->is_variadic = is_variadic;
- cur_arg_info->class_name = NULL;
- cur_arg_info->class_name_len = 0;
-
- if (class_type->op_type != IS_UNUSED) {
- cur_arg_info->allow_null = 0;
-
- if (Z_TYPE(class_type->u.constant) != IS_NULL) {
- if (Z_TYPE(class_type->u.constant) == IS_ARRAY) {
- cur_arg_info->type_hint = IS_ARRAY;
- if (op == ZEND_RECV_INIT) {
- if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
- cur_arg_info->allow_null = 1;
- } else if (Z_TYPE(initialization->u.constant) != IS_ARRAY) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL");
- }
- }
- } else if (Z_TYPE(class_type->u.constant) == IS_CALLABLE) {
- cur_arg_info->type_hint = IS_CALLABLE;
- if (op == ZEND_RECV_INIT) {
- if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
- cur_arg_info->allow_null = 1;
- } else {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with callable type hint can only be NULL");
- }
- }
- } else {
- cur_arg_info->type_hint = IS_OBJECT;
- if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant))) {
- zend_resolve_class_name_old(class_type TSRMLS_CC);
- }
- Z_STR(class_type->u.constant) = zend_new_interned_string(Z_STR(class_type->u.constant) TSRMLS_CC);
- if (IS_INTERNED(Z_STR(class_type->u.constant))) {
- Z_TYPE_FLAGS(class_type->u.constant) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
- }
-// TODO: for now we have to copy it ???
-#if 1
- cur_arg_info->class_name = estrndup(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant));
- cur_arg_info->class_name_len = Z_STRLEN(class_type->u.constant);
- STR_RELEASE(Z_STR(class_type->u.constant));
-#else
- cur_arg_info->class_name = Z_STRVAL(class_type->u.constant);
- cur_arg_info->class_name_len = Z_STRLEN(class_type->u.constant);
-#endif
- if (op == ZEND_RECV_INIT) {
- if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
- cur_arg_info->allow_null = 1;
- } else {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with a class type hint can only be NULL");
- }
- }
- }
- }
- }
-
- if (cur_arg_info->class_name || cur_arg_info->type_hint) {
- CG(active_op_array)->fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
- }
-}
-/* }}} */
-
zend_string *zend_concat3(
char *str1, size_t str1_len, char *str2, size_t str2_len, char *str3, size_t str3_len
) {
}
/* }}} */
-void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC) /* {{{ */
-{
- zval tmp;
- zend_op *opline;
- znode lval;
- znode result;
-
- if (static_assignment) {
- ZVAL_COPY_VALUE(&tmp, &static_assignment->u.constant);
- } else {
- ZVAL_NULL(&tmp);
- Z_CONST_FLAGS(tmp) = 0;
- }
- if (!CG(active_op_array)->static_variables) {
- if (CG(active_op_array)->scope) {
- CG(active_op_array)->scope->ce_flags |= ZEND_HAS_STATIC_IN_METHODS;
- }
- ALLOC_HASHTABLE(CG(active_op_array)->static_variables);
- zend_hash_init(CG(active_op_array)->static_variables, 8, NULL, ZVAL_PTR_DTOR, 0);
- }
- zend_hash_update(CG(active_op_array)->static_variables, Z_STR(varname->u.constant), &tmp);
-
- if (varname->op_type == IS_CONST) {
- if (Z_TYPE(varname->u.constant) != IS_STRING) {
- convert_to_string(&varname->u.constant);
- }
- }
-
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = (fetch_type == ZEND_FETCH_LEXICAL) ? ZEND_FETCH_R : ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */
- opline->result_type = IS_VAR;
- opline->result.var = get_temporary_variable(CG(active_op_array));
- SET_NODE(opline->op1, varname);
- SET_UNUSED(opline->op2);
- opline->extended_value = ZEND_FETCH_STATIC;
- GET_NODE(&result, opline->result);
-
- if (varname->op_type == IS_CONST) {
- zval_copy_ctor(&varname->u.constant);
- }
- fetch_simple_variable(&lval, varname, 0 TSRMLS_CC); /* Relies on the fact that the default fetch is BP_VAR_W */
-
- if (fetch_type == ZEND_FETCH_LEXICAL) {
- znode dummy;
-
- zend_do_begin_variable_parse(TSRMLS_C);
- zend_do_assign(&dummy, &lval, &result TSRMLS_CC);
- zend_do_free(&dummy TSRMLS_CC);
- } else {
- zend_do_assign_ref(NULL, &lval, &result TSRMLS_CC);
- }
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result_type |= EXT_TYPE_UNUSED;
-}
-/* }}} */
-
-void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC) /* {{{ */
-{
- znode value;
-
- if (Z_STRLEN(varname->u.constant) == sizeof("this") - 1 &&
- memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this") - 1) == 0) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as lexical variable");
- return;
- }
-
- value.op_type = IS_CONST;
- ZVAL_NULL(&value.u.constant);
- Z_CONST_FLAGS(value.u.constant) = is_ref ? IS_LEXICAL_REF : IS_LEXICAL_VAR;
- zend_do_fetch_static_variable(varname, &value, is_ref ? ZEND_FETCH_STATIC : ZEND_FETCH_LEXICAL TSRMLS_CC);
-}
-/* }}} */
-
void zend_do_declare_begin(TSRMLS_D) /* {{{ */
{
zend_stack_push(&CG(declare_stack), &CG(declarables));