From 6499162ff0d8aa6e862d3e3cdd2288b87636b8a1 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 28 Apr 2016 04:13:34 +0300 Subject: - get rid of EG(scope). zend_get_executed_scope() should be used instead. - ichanged zval_update_constant_ex(). Use IS_TYPE_IMMUTABLE flag on shared constants and AST, instead of "inline_change" parameter. --- Zend/zend_objects.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'Zend/zend_objects.c') diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 0f052335db..53d215d27e 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -96,39 +96,39 @@ ZEND_API void zend_objects_destroy_object(zend_object *object) if (destructor->op_array.fn_flags & ZEND_ACC_PRIVATE) { /* Ensure that if we're calling a private function, we're allowed to do so. */ - if (object->ce != EG(scope)) { - zend_class_entry *ce = object->ce; + if (EG(current_execute_data)) { + zend_class_entry *scope = zend_get_executed_scope(); - if (EG(current_execute_data)) { + if (object->ce != scope) { zend_throw_error(NULL, "Call to private %s::__destruct() from context '%s'", - ZSTR_VAL(ce->name), - EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); - } else { - zend_error(E_WARNING, - "Call to private %s::__destruct() from context '%s' during shutdown ignored", - ZSTR_VAL(ce->name), - EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); + ZSTR_VAL(object->ce->name), + scope ? ZSTR_VAL(scope->name) : ""); + return; } + } else { + zend_error(E_WARNING, + "Call to private %s::__destruct() from context '' during shutdown ignored", + ZSTR_VAL(object->ce->name)); return; } } else { /* Ensure that if we're calling a protected function, we're allowed to do so. */ - if (!zend_check_protected(zend_get_function_root_class(destructor), EG(scope))) { - zend_class_entry *ce = object->ce; + if (EG(current_execute_data)) { + zend_class_entry *scope = zend_get_executed_scope(); - if (EG(current_execute_data)) { + if (!zend_check_protected(zend_get_function_root_class(destructor), scope)) { zend_throw_error(NULL, "Call to protected %s::__destruct() from context '%s'", - ZSTR_VAL(ce->name), - EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); - } else { - zend_error(E_WARNING, - "Call to protected %s::__destruct() from context '%s' during shutdown ignored", - ZSTR_VAL(ce->name), - EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); + ZSTR_VAL(object->ce->name), + scope ? ZSTR_VAL(scope->name) : ""); + return; } + } else { + zend_error(E_WARNING, + "Call to protected %s::__destruct() from context '' during shutdown ignored", + ZSTR_VAL(object->ce->name)); return; } } -- cgit v1.2.1