diff --git a/zend/base.cpp b/zend/base.cpp index 4cb3cd85..ed6fe3bc 100644 --- a/zend/base.cpp +++ b/zend/base.cpp @@ -17,9 +17,8 @@ namespace Php { */ void Base::__destruct() const { - // throw exception, so that the PHP-CPP library will check if the user - // somehow registered an explicit __destruct method - throw NotImplemented(); + // destroy the object by default + zend_objects_destroy_object(_impl->php()); } /** diff --git a/zend/classimpl.cpp b/zend/classimpl.cpp index 6ff96c02..def3e706 100644 --- a/zend/classimpl.cpp +++ b/zend/classimpl.cpp @@ -1130,7 +1130,9 @@ void ClassImpl::destructObject(zend_object *object) } catch (const NotImplemented &exception) { - // fallback on the default destructor call + // fallback on the default destructor call in case a derived object + // of Base throws this. The default implementation will call this + // function in any case. zend_objects_destroy_object(object); } catch (Throwable &throwable)