zval old_error_reporting;
zend_bool nested;
zval *return_value;
-//??? zend_class_entry *current_scope;
-//??? zend_class_entry *current_called_scope;
-//??? zval *current_this;
+//???
+ zend_class_entry *current_scope;
+ zend_class_entry *current_called_scope;
+ zval current_this;
struct _zend_op *fast_ret; /* used by FAST_CALL/FAST_RET (finally keyword) */
zend_object *delayed_exception;
call_slot *call_slots;
EG(argument_stack)->top = (zval*)zend_vm_stack_frame_base(execute_data);
ZVAL_UNDEF(&EX(object));
-//??? EX(current_this) = NULL;
+ ZVAL_UNDEF(&EX(current_this));
ZVAL_UNDEF(&EX(old_error_reporting));
EX(symbol_table) = EG(active_symbol_table);
EX(call) = NULL;
zend_clean_and_cache_symbol_table(execute_data->symbol_table TSRMLS_CC);
}
-//??? if (execute_data->current_this) {
-//??? zval_ptr_dtor(&execute_data->current_this);
-//??? }
+ zval_ptr_dtor(&execute_data->current_this);
/* A fatal error / die occurred during the generator execution. Trying to clean
* up the stack may not be safe in this case. */
}
/* Back up executor globals. */
-//??? execute_data->current_scope = EG(scope);
-//??? execute_data->current_called_scope = EG(called_scope);
+ execute_data->current_scope = EG(scope);
+ execute_data->current_called_scope = EG(called_scope);
execute_data->symbol_table = EG(active_symbol_table);
-//??? execute_data->current_this = EG(This);
+ ZVAL_COPY_VALUE(&execute_data->current_this, &EG(This));
/* Save execution context in generator object. */
generator = (zend_generator *) Z_OBJ_P(return_value);
EG(opline_ptr) = &generator->execute_data->opline;
EG(active_op_array) = generator->execute_data->op_array;
EG(active_symbol_table) = generator->execute_data->symbol_table;
-//??? EG(This) = generator->execute_data->current_this;
-//??? EG(scope) = generator->execute_data->current_scope;
-//??? EG(called_scope) = generator->execute_data->current_called_scope;
+ ZVAL_COPY_VALUE(&EG(This), &generator->execute_data->current_this);
+ EG(scope) = generator->execute_data->current_scope;
+ EG(called_scope) = generator->execute_data->current_called_scope;
EG(argument_stack) = generator->stack;
/* We want the backtrace to look as if the generator function was
}
zval_ptr_dtor(&EG(This));
}
-//??? EG(This) = EX(current_this);
-//??? EG(scope) = EX(current_scope);
-//??? EG(called_scope) = EX(current_called_scope);
+ ZVAL_COPY_VALUE(&EG(This), &EX(current_this));
+ EG(scope) = EX(current_scope);
+ EG(called_scope) = EX(current_called_scope);
EX(call)--;
if (fbc->type == ZEND_USER_FUNCTION || fbc->common.scope) {
should_change_scope = 1;
-//??? EX(current_this) = EG(This);
-//??? EX(current_scope) = EG(scope);
-//??? EX(current_called_scope) = EG(called_scope);
+ ZVAL_COPY_VALUE(&EX(current_this), &EG(This));
+ EX(current_scope) = EG(scope);
+ EX(current_called_scope) = EG(called_scope);
EG(This) = EX(object);
EG(scope) = (fbc->type == ZEND_USER_FUNCTION || Z_TYPE(EX(object)) == IS_UNDEF) ? fbc->common.scope : NULL;
EG(called_scope) = EX(call)->called_scope;
}
zval_ptr_dtor(&EG(This));
}
-//??? EG(This) = EX(current_this);
-//??? EG(scope) = EX(current_scope);
-//??? EG(called_scope) = EX(current_called_scope);
+ ZVAL_COPY_VALUE(&EG(This), &EX(current_this));
+ EG(scope) = EX(current_scope);
+ EG(called_scope) = EX(current_called_scope);
}
EX(call)--;
} else {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
if (OP1_TYPE == IS_CV) {
- Z_ADDREF_P(retval_ptr);
+ if (IS_REFCOUNTED(Z_TYPE_P(retval_ptr))) Z_ADDREF_P(retval_ptr);
}
}
}
}
zval_ptr_dtor(&EG(This));
}
-//??? EG(This) = EX(current_this);
-//??? EG(scope) = EX(current_scope);
-//??? EG(called_scope) = EX(current_called_scope);
+ ZVAL_COPY_VALUE(&EG(This), &EX(current_this));
+ EG(scope) = EX(current_scope);
+ EG(called_scope) = EX(current_called_scope);
EX(call)--;
if (fbc->type == ZEND_USER_FUNCTION || fbc->common.scope) {
should_change_scope = 1;
-//??? EX(current_this) = EG(This);
-//??? EX(current_scope) = EG(scope);
-//??? EX(current_called_scope) = EG(called_scope);
+ ZVAL_COPY_VALUE(&EX(current_this), &EG(This));
+ EX(current_scope) = EG(scope);
+ EX(current_called_scope) = EG(called_scope);
EG(This) = EX(object);
EG(scope) = (fbc->type == ZEND_USER_FUNCTION || Z_TYPE(EX(object)) == IS_UNDEF) ? fbc->common.scope : NULL;
EG(called_scope) = EX(call)->called_scope;
}
zval_ptr_dtor(&EG(This));
}
-//??? EG(This) = EX(current_this);
-//??? EG(scope) = EX(current_scope);
-//??? EG(called_scope) = EX(current_called_scope);
+ ZVAL_COPY_VALUE(&EG(This), &EX(current_this));
+ EG(scope) = EX(current_scope);
+ EG(called_scope) = EX(current_called_scope);
}
EX(call)--;
} else {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
if (IS_CONST == IS_CV) {
- Z_ADDREF_P(retval_ptr);
+ if (IS_REFCOUNTED(Z_TYPE_P(retval_ptr))) Z_ADDREF_P(retval_ptr);
}
}
}
} else {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
if (IS_TMP_VAR == IS_CV) {
- Z_ADDREF_P(retval_ptr);
+ if (IS_REFCOUNTED(Z_TYPE_P(retval_ptr))) Z_ADDREF_P(retval_ptr);
}
}
}
} else {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
if (IS_VAR == IS_CV) {
- Z_ADDREF_P(retval_ptr);
+ if (IS_REFCOUNTED(Z_TYPE_P(retval_ptr))) Z_ADDREF_P(retval_ptr);
}
}
}
} else {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
if (IS_CV == IS_CV) {
- Z_ADDREF_P(retval_ptr);
+ if (IS_REFCOUNTED(Z_TYPE_P(retval_ptr))) Z_ADDREF_P(retval_ptr);
}
}
}
EG(opline_ptr) = &PHPDBG_EX(opline);
EG(active_op_array) = PHPDBG_EX(op_array);
EG(active_symbol_table) = PHPDBG_EX(symbol_table);
- //!!!EG(This) = PHPDBG_EX(current_this);
- //!!!EG(scope) = PHPDBG_EX(current_scope);
- //!!!EG(called_scope) = PHPDBG_EX(current_called_scope);
+ ZVAL_COPY_VALUE(&EG(This), &PHPDBG_EX(current_this));
+ EG(scope) = PHPDBG_EX(current_scope);
+ EG(called_scope) = PHPDBG_EX(current_called_scope);
} /* }}} */
void phpdbg_switch_frame(int frame TSRMLS_DC) /* {{{ */
EG(opline_ptr) = &PHPDBG_EX(opline);
EG(active_op_array) = PHPDBG_EX(op_array);
EG(active_symbol_table) = PHPDBG_EX(symbol_table);
- //!!!EG(This) = PHPDBG_EX(current_this);
- //!!!EG(scope) = PHPDBG_EX(current_scope);
- //!!!EG(called_scope) = PHPDBG_EX(current_called_scope);
+ ZVAL_COPY_VALUE(&EG(This), &PHPDBG_EX(current_this));
+ EG(scope) = PHPDBG_EX(current_scope);
+ EG(called_scope) = PHPDBG_EX(current_called_scope);
}
phpdbg_notice("Switched to frame #%d", frame);