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(&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)",
object->ce->name, Z_OBJCE_P(old_exception)->name, Z_STRVAL_P(file), Z_LVAL_P(line));
- zval_ptr_dtor(&EG(exception));
}
EG(exception) = old_exception;
}
ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC)
{
struct _store_object *obj;
+ int failure = 0;
if (!EG(objects_store).object_buckets) {
return;
EG(objects_store).object_buckets[handle].destructor_called = 1;
if (obj->dtor) {
- obj->dtor(obj->object, handle TSRMLS_CC);
+ zend_try {
+ obj->dtor(obj->object, handle TSRMLS_CC);
+ } zend_catch {
+ failure = 1;
+ } zend_end_try();
}
}
if (obj->refcount == 1) {
if (obj->free_storage) {
- obj->free_storage(obj->object TSRMLS_CC);
+ zend_try {
+ obj->free_storage(obj->object TSRMLS_CC);
+ } zend_catch {
+ failure = 1;
+ } zend_end_try();
}
ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST();
}
fprintf(stderr, "Decreased refcount of object id #%d\n", handle);
}
#endif
+ if (failure) {
+ zend_bailout();
+ }
}
ZEND_API zend_object_value zend_objects_store_clone_obj(zval *zobject TSRMLS_DC)