Skip to content

Commit

Permalink
Merge pull request #483 from CopernicaMarketingSoftware/34296
Browse files Browse the repository at this point in the history
Improve performance of destructing objects
  • Loading branch information
EmielBruijntjes authored Aug 4, 2021
2 parents 26cbf1e + 3db7eed commit 7394e67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions zend/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand Down
4 changes: 3 additions & 1 deletion zend/classimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7394e67

Please sign in to comment.