Skip to content

Commit 7394e67

Browse files
Merge pull request #483 from CopernicaMarketingSoftware/34296
Improve performance of destructing objects
2 parents 26cbf1e + 3db7eed commit 7394e67

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

zend/base.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ namespace Php {
1717
*/
1818
void Base::__destruct() const
1919
{
20-
// throw exception, so that the PHP-CPP library will check if the user
21-
// somehow registered an explicit __destruct method
22-
throw NotImplemented();
20+
// destroy the object by default
21+
zend_objects_destroy_object(_impl->php());
2322
}
2423

2524
/**

zend/classimpl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,9 @@ void ClassImpl::destructObject(zend_object *object)
11301130
}
11311131
catch (const NotImplemented &exception)
11321132
{
1133-
// fallback on the default destructor call
1133+
// fallback on the default destructor call in case a derived object
1134+
// of Base throws this. The default implementation will call this
1135+
// function in any case.
11341136
zend_objects_destroy_object(object);
11351137
}
11361138
catch (Throwable &throwable)

0 commit comments

Comments
 (0)