thrown from the constructor
if (EG(This)) {
if (EG(exception) && EX(fbc) && EX(fbc)->common.fn_flags&ZEND_ACC_CTOR) {
EG(This)->refcount--;
+ if (EG(This)->refcount == 1) {
+ zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
+ }
zval_ptr_dtor(&EG(This));
} else if (should_change_scope) {
zval_ptr_dtor(&EG(This));
}
+/* Called when the ctor was terminated by an exception */
+ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC)
+{
+ zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
+
+ EG(objects_store).object_buckets[handle].destructor_called = 1;
+}
+
+
/* Proxy objects workings */
typedef struct _zend_proxy_object {
zval *object;
ZEND_API void *zend_object_store_get_object(zval *object TSRMLS_DC);
/* See comment in zend_objects_API.c before you use this */
ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC);
+ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC);
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC);