com php-src: EG(fake_scope) was always set to N ULL wrongly: Zend/zend_objects.c
| From: | Xinchen Hui | Date: | Sun, 12 Jun 2016 07:32:04 +0000 |
| Subject: | com php-src: EG(fake_scope) was always set to N ULL wrongly: Zend/zend_objects.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92357@lists.php.net to get a copy of this message | ||
Commit: ae3be78ce8f73a3b4b80a4eb81eddd6b3d019bb1
Author: Xinchen Hui <laruence@gmail.com> Sun, 12 Jun 2016 15:17:03 +0800
Parents: 3f77db05102009bc49cfeb0d0660508b43f3f335
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ae3be78ce8f73a3b4b80a4eb81eddd6b3d019bb1
Log:
EG(fake_scope) was always set to NULL wrongly
Changed paths:
M Zend/zend_objects.c
Diff:
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
index b5f19b3..1e35899 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -91,9 +91,8 @@ ZEND_API void zend_objects_destroy_object(zend_object *object)
if (destructor) {
zend_object *old_exception;
zval obj;
- zend_class_entry *orig_fake_scope = NULL;
+ zend_class_entry *orig_fake_scope;
- EG(fake_scope) = NULL;
if (destructor->op_array.fn_flags & (ZEND_ACC_PRIVATE|ZEND_ACC_PROTECTED)) {
if (destructor->op_array.fn_flags & ZEND_ACC_PRIVATE) {
/* Ensure that if we're calling a private function, we're allowed to do so.
@@ -106,14 +105,12 @@ ZEND_API void zend_objects_destroy_object(zend_object *object)
"Call to private %s::__destruct() from context '%s'",
ZSTR_VAL(object->ce->name),
scope ? ZSTR_VAL(scope->name) : "");
- EG(fake_scope) = orig_fake_scope;
return;
}
} else {
zend_error(E_WARNING,
"Call to private %s::__destruct() from context '' during shutdown
ignored",
ZSTR_VAL(object->ce->name));
- EG(fake_scope) = orig_fake_scope;
return;
}
} else {
@@ -127,21 +124,19 @@ ZEND_API void zend_objects_destroy_object(zend_object *object)
"Call to protected %s::__destruct() from context '%s'",
ZSTR_VAL(object->ce->name),
scope ? ZSTR_VAL(scope->name) : "");
- EG(fake_scope) = orig_fake_scope;
return;
}
} else {
zend_error(E_WARNING,
"Call to protected %s::__destruct() from context '' during shutdown
ignored",
ZSTR_VAL(object->ce->name));
- EG(fake_scope) = orig_fake_scope;
return;
}
}
}
+ GC_REFCOUNT(object)++;
ZVAL_OBJ(&obj, object);
- Z_ADDREF(obj);
/* Make sure that destructors are protected from previously thrown exceptions.
* For example, if an exception was thrown in a function and when the function's
@@ -156,6 +151,8 @@ ZEND_API void zend_objects_destroy_object(zend_object *object)
EG(exception) = NULL;
}
}
+ orig_fake_scope = EG(fake_scope);
+ EG(fake_scope) = NULL;
zend_call_method_with_0_params(&obj, object->ce, &destructor,
ZEND_DESTRUCTOR_FUNC_NAME, NULL);
if (old_exception) {
if (EG(exception)) {