summaryrefslogtreecommitdiff
path: root/Zend/zend_objects.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-07-26 15:29:27 +0000
committerDmitry Stogov <dmitry@php.net>2006-07-26 15:29:27 +0000
commit30f4d3f9593d3add25510901de3c5811e9a0a2a5 (patch)
tree09526e19e9d5fdba00e1187745ee7d9fae7af641 /Zend/zend_objects.c
parente1dfc4259f636deae6115a344b3d916c63f0f102 (diff)
downloadphp-git-30f4d3f9593d3add25510901de3c5811e9a0a2a5.tar.gz
Fixed bug #38220 (Crash on some object operations)
Diffstat (limited to 'Zend/zend_objects.c')
-rw-r--r--Zend/zend_objects.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
index 6dc4ba4aa3..bb713680d6 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -52,7 +52,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
zend_function *destructor = object->ce->destructor;
if (destructor) {
- zval zobj, *obj = &zobj;
+ zval *obj;
zval *old_exception;
if (destructor->op_array.fn_flags & (ZEND_ACC_PRIVATE|ZEND_ACC_PROTECTED)) {
@@ -85,10 +85,12 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
}
}
- Z_TYPE(zobj) = IS_OBJECT;
- Z_OBJ_HANDLE(zobj) = handle;
- Z_OBJ_HT(zobj) = &std_object_handlers;
- INIT_PZVAL(obj);
+ MAKE_STD_ZVAL(obj);
+ Z_TYPE_P(obj) = IS_OBJECT;
+ Z_OBJ_HANDLE_P(obj) = handle;
+ /* TODO: We cannot set proper handlers. */
+ Z_OBJ_HT_P(obj) = &std_object_handlers;
+ zval_copy_ctor(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
@@ -103,6 +105,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
zval *file = zend_read_property(default_exception_ce, old_exception, "file", sizeof("file")-1, 1 TSRMLS_CC);
zval *line = zend_read_property(default_exception_ce, old_exception, "line", sizeof("line")-1, 1 TSRMLS_CC);
+ zval_ptr_dtor(&obj);
zval_ptr_dtor(&EG(exception));
EG(exception) = old_exception;
zend_error(E_ERROR, "Ignoring exception from %s::__destruct() while an exception is already active (Uncaught %s in %s on line %ld)",
@@ -110,6 +113,7 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
}
EG(exception) = old_exception;
}
+ zval_ptr_dtor(&obj);
}
}