diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index b240d233f75..a3cd824fdda 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4604,6 +4604,8 @@ ZEND_METHOD(reflection_class, isCloneable) if (UNEXPECTED(object_init_ex(&obj, ce) != SUCCESS)) { return; } + /* We're not calling the constructor, so don't call the destructor either. */ + zend_object_store_ctor_failed(Z_OBJ(obj)); RETVAL_BOOL(Z_OBJ_HANDLER(obj, clone_obj) != NULL); zval_ptr_dtor(&obj); } diff --git a/ext/reflection/tests/bug79115.phpt b/ext/reflection/tests/bug79115.phpt new file mode 100644 index 00000000000..b8ba6f1d7ff --- /dev/null +++ b/ext/reflection/tests/bug79115.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #79115: ReflectionClass::isCloneable call reflected class __destruct +--FILE-- +isCloneable()); + +?> +--EXPECT-- +bool(true)