if (!EG(scope)) {
if (error) *error = estrdup("cannot access self:: when no class scope is active");
} else {
- fcc->called_scope = EG(called_scope);
+ fcc->called_scope = EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL;
fcc->calling_scope = EG(scope);
if (!fcc->object && Z_OBJ(EG(This))) {
fcc->object = Z_OBJ(EG(This));
} else if (!EG(scope)->parent) {
if (error) *error = estrdup("cannot access parent:: when current class scope has no parent");
} else {
- fcc->called_scope = EG(called_scope);
+ fcc->called_scope = EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL;
fcc->calling_scope = EG(scope)->parent;
if (!fcc->object && Z_OBJ(EG(This))) {
fcc->object = Z_OBJ(EG(This));
}
} else if (name_len == sizeof("static") - 1 &&
!memcmp(lcname->val, "static", sizeof("static") - 1)) {
- if (!EG(called_scope)) {
+ if (!EG(current_execute_data) || !EG(current_execute_data)->called_scope) {
if (error) *error = estrdup("cannot access static:: when no class scope is active");
} else {
- fcc->called_scope = EG(called_scope);
- fcc->calling_scope = EG(called_scope);
+ fcc->called_scope = EG(current_execute_data)->called_scope;
+ fcc->calling_scope = EG(current_execute_data)->called_scope;
if (!fcc->object && Z_OBJ(EG(This))) {
fcc->object = Z_OBJ(EG(This));
}
return;
}
- if (EG(called_scope)) {
- RETURN_STR(STR_COPY(EG(called_scope)->name));
+ if (EG(current_execute_data)->called_scope) {
+ RETURN_STR(STR_COPY(EG(current_execute_data)->called_scope->name));
} else if (!EG(scope)) {
zend_error(E_WARNING, "get_called_class() called from outside a class");
}
}
} else if (class_name_len == sizeof("static")-1 &&
!memcmp(lcname, "static", sizeof("static")-1)) {
- if (EG(called_scope)) {
- ce = EG(called_scope);
+ if (EG(current_execute_data) && EG(current_execute_data)->called_scope) {
+ ce = EG(current_execute_data)->called_scope;
} else {
zend_error(E_ERROR, "Cannot access static:: when no class scope is active");
}
{
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
ZEND_ASSERT(EX(object) == Z_OBJ(EG(This)));
- ZEND_ASSERT(EX(called_scope) == EG(called_scope));
EX(return_value) = return_value;
EX(frame_kind) = frame_kind;
EG(prev_exception) = NULL;
EG(scope) = NULL;
- EG(called_scope) = NULL;
ZVAL_OBJ(&EG(This), NULL);
zend_uint i;
zend_array *calling_symbol_table;
zend_class_entry *calling_scope = NULL;
- zend_class_entry *called_scope = NULL;
zend_execute_data *call, dummy_execute_data;
zend_fcall_info_cache fci_cache_local;
zend_function *func;
zend_object *orig_object;
- zend_class_entry *orig_scope, *orig_called_scope;
+ zend_class_entry *orig_scope;
zval tmp;
ZVAL_UNDEF(fci->retval);
orig_object = Z_OBJ(EG(This));
orig_scope = EG(scope);
- orig_called_scope = EG(called_scope);
/* Initialize execute_data */
if (!EG(current_execute_data)) {
func = fci_cache->function_handler;
call = zend_vm_stack_push_call_frame(func, fci->param_count, ZEND_CALL_DONE, fci_cache->called_scope, fci_cache->object, NULL TSRMLS_CC);
calling_scope = fci_cache->calling_scope;
- called_scope = fci_cache->called_scope;
fci->object = fci_cache->object;
if (fci->object &&
(!EG(objects_store).object_buckets ||
call->num_args = fci->param_count;
EG(scope) = calling_scope;
- EG(called_scope) = called_scope;
if (!fci->object ||
(func->common.fn_flags & ZEND_ACC_STATIC)) {
Z_OBJ(EG(This)) = call->object = NULL;
Z_OBJ(EG(This)) = orig_object;
EG(scope) = orig_scope;
- EG(called_scope) = orig_called_scope;
if (EG(current_execute_data) == &dummy_execute_data) {
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
}
ZVAL_UNDEF(&local_retval);
if (EG(current_execute_data)) {
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
}
zend_execute(new_op_array, &local_retval TSRMLS_CC);
} zend_catch {
}
return EG(scope)->parent;
case ZEND_FETCH_CLASS_STATIC:
- if (!EG(called_scope)) {
+ if (!EG(current_execute_data) || !EG(current_execute_data)->called_scope) {
zend_error(E_ERROR, "Cannot access static:: when no class scope is active");
}
- return EG(called_scope);
+ return EG(current_execute_data)->called_scope;
case ZEND_FETCH_CLASS_AUTO: {
fetch_type = zend_get_class_fetch_type(class_name->val, class_name->len);
if (fetch_type!=ZEND_FETCH_CLASS_DEFAULT) {
zend_array *original_active_symbol_table = EG(active_symbol_table);
zend_object *original_This;
zend_class_entry *original_scope = EG(scope);
- zend_class_entry *original_called_scope = EG(called_scope);
zend_vm_stack original_stack = EG(argument_stack);
original_This = Z_OBJ(EG(This));
EG(active_symbol_table) = generator->execute_data->symbol_table;
Z_OBJ(EG(This)) = generator->execute_data->object;
EG(scope) = generator->execute_data->scope;
- EG(called_scope) = generator->execute_data->called_scope;
EG(argument_stack) = generator->stack;
/* We want the backtrace to look as if the generator function was
EG(active_symbol_table) = original_active_symbol_table;
Z_OBJ(EG(This)) = original_This;
EG(scope) = original_scope;
- EG(called_scope) = original_called_scope;
EG(argument_stack) = original_stack;
/* If an exception was thrown in the generator we have to internally
HashTable *zend_constants; /* constants table */
zend_class_entry *scope;
- zend_class_entry *called_scope; /* Scope of the calling class */
zval This;
if (object) {
fcic.called_scope = Z_OBJCE_P(object);
} else if (obj_ce &&
- !(EG(called_scope) &&
- instanceof_function(EG(called_scope), obj_ce TSRMLS_CC))) {
+ !(EG(current_execute_data) &&
+ EG(current_execute_data)->called_scope &&
+ instanceof_function(EG(current_execute_data)->called_scope, obj_ce TSRMLS_CC))) {
fcic.called_scope = obj_ce;
} else {
- fcic.called_scope = EG(called_scope);
+ fcic.called_scope = EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL;
}
fcic.object = object ? Z_OBJ_P(object) : NULL;
result = zend_call_function(&fci, &fcic TSRMLS_CC);
}
Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
- EG(called_scope) = EX(called_scope);
if (UNEXPECTED(EG(exception) != NULL)) {
zend_op *opline = EX(opline);
if (OP1_TYPE != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
#else
EG(scope) = fbc->common.scope;
#endif
- EG(called_scope) = call->called_scope;
+ } else {
+ call->called_scope = EX(called_scope);
}
call->opline = NULL;
Z_OBJ(EG(This)) = call->object;
EG(scope) = fbc->common.scope;
- EG(called_scope) = call->called_scope;
EG(active_symbol_table) = NULL;
if (RETURN_VALUE_USED(opline)) {
return_value = EX_VAR(opline->result.var);
Z_OBJ(EG(This)) = call->object;
//??? EG(scope) = NULL;
EG(scope) = fbc->common.scope;
- EG(called_scope) = call->called_scope;
ZVAL_NULL(EX_VAR(opline->result.var));
}
Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
- EG(called_scope) = EX(called_scope);
ZEND_VM_C_LABEL(fcall_end):
if (UNEXPECTED(EG(exception) != NULL)) {
}
EX(call) = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
closure_is_static = Z_FUNC_P(zfunc)->common.fn_flags & ZEND_ACC_STATIC;
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->call->func->common.fn_flags & ZEND_ACC_STATIC;
if (closure_is_static || closure_is_being_defined_inside_static_context) {
- zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(called_scope), NULL TSRMLS_CC);
+ zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(called_scope), NULL TSRMLS_CC);
} else {
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(scope), Z_OBJ(EG(This)) ? &EG(This) : NULL TSRMLS_CC);
}
execute_data = EG(current_execute_data)->call;
} else {
execute_data = zend_vm_stack_push_call_frame(
- (zend_function*)op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), NULL TSRMLS_CC);
+ (zend_function*)op_array, 0, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, Z_OBJ(EG(This)), NULL TSRMLS_CC);
}
EX(prev_execute_data) = EG(current_execute_data);
i_init_execute_data(execute_data, op_array, return_value, EG(active_symbol_table) ? VM_FRAME_TOP_CODE : VM_FRAME_TOP_FUNCTION TSRMLS_CC);
}
Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
- EG(called_scope) = EX(called_scope);
if (UNEXPECTED(EG(exception) != NULL)) {
zend_op *opline = EX(opline);
#else
EG(scope) = fbc->common.scope;
#endif
- EG(called_scope) = call->called_scope;
+ } else {
+ call->called_scope = EX(called_scope);
}
call->opline = NULL;
Z_OBJ(EG(This)) = call->object;
EG(scope) = fbc->common.scope;
- EG(called_scope) = call->called_scope;
EG(active_symbol_table) = NULL;
if (RETURN_VALUE_USED(opline)) {
return_value = EX_VAR(opline->result.var);
Z_OBJ(EG(This)) = call->object;
//??? EG(scope) = NULL;
EG(scope) = fbc->common.scope;
- EG(called_scope) = call->called_scope;
ZVAL_NULL(EX_VAR(opline->result.var));
}
Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
- EG(called_scope) = EX(called_scope);
fcall_end:
if (UNEXPECTED(EG(exception) != NULL)) {
}
EX(call) = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
if (IS_CONST != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
if (IS_CONST != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
if (IS_CONST != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
if (IS_CONST != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
closure_is_static = Z_FUNC_P(zfunc)->common.fn_flags & ZEND_ACC_STATIC;
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->call->func->common.fn_flags & ZEND_ACC_STATIC;
if (closure_is_static || closure_is_being_defined_inside_static_context) {
- zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(called_scope), NULL TSRMLS_CC);
+ zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(called_scope), NULL TSRMLS_CC);
} else {
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(scope), Z_OBJ(EG(This)) ? &EG(This) : NULL TSRMLS_CC);
}
if (IS_CONST != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
}
EX(call) = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
}
EX(call) = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
if (IS_VAR != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
if (IS_VAR != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
if (IS_VAR != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
if (IS_VAR != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
if (IS_VAR != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
}
EX(call) = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
execute_data = EG(current_execute_data)->call;
} else {
execute_data = zend_vm_stack_push_call_frame(
- (zend_function*)op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), NULL TSRMLS_CC);
+ (zend_function*)op_array, 0, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, Z_OBJ(EG(This)), NULL TSRMLS_CC);
}
EX(prev_execute_data) = EG(current_execute_data);
i_init_execute_data(execute_data, op_array, return_value, EG(active_symbol_table) ? VM_FRAME_TOP_CODE : VM_FRAME_TOP_FUNCTION TSRMLS_CC);
zend_try {
if (EG(current_execute_data)) {
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
}
zend_execute(new_op_array, &result TSRMLS_CC);
if (PHAR_G(cwd)) {
ZVAL_UNDEF(&result);
if (EG(current_execute_data)) {
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
}
zend_execute(new_op_array, &result TSRMLS_CC);
fci.retval = &retval;
- if (EG(called_scope) &&
- instanceof_function(EG(called_scope), fci_cache.calling_scope TSRMLS_CC)) {
- fci_cache.called_scope = EG(called_scope);
+ if (EG(current_execute_data)->called_scope &&
+ instanceof_function(EG(current_execute_data)->called_scope, fci_cache.calling_scope TSRMLS_CC)) {
+ fci_cache.called_scope = EG(current_execute_data)->called_scope;
}
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
zend_fcall_info_args(&fci, params TSRMLS_CC);
fci.retval = &retval;
- if (EG(called_scope) &&
- instanceof_function(EG(called_scope), fci_cache.calling_scope TSRMLS_CC)) {
- fci_cache.called_scope = EG(called_scope);
+ if (EG(current_execute_data)->called_scope &&
+ instanceof_function(EG(current_execute_data)->called_scope, fci_cache.calling_scope TSRMLS_CC)) {
+ fci_cache.called_scope = EG(current_execute_data)->called_scope;
}
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {