Skip to content

Commit

Permalink
Remove SimpleXMLElement dtor_obj handler
Browse files Browse the repository at this point in the history
I don't see any reason why this cleanup needs to happen inside
dtor_obj.

If there is a reason, it's lacking in test coverage...
  • Loading branch information
nikic committed Jun 9, 2021
1 parent 3fa0c99 commit cde735e
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions ext/simplexml/simplexml.c
Expand Up @@ -2146,14 +2146,15 @@ sxe_object_clone(zend_object *object)
}
/* }}} */

/* {{{ sxe_object_dtor() */
static void sxe_object_dtor(zend_object *object)
/* {{{ sxe_object_free_storage() */
static void sxe_object_free_storage(zend_object *object)
{
/* dtor required to cleanup iterator related data properly */
php_sxe_object *sxe;

sxe = php_sxe_fetch_object(object);

zend_object_std_dtor(&sxe->zo);

if (!Z_ISUNDEF(sxe->iter.data)) {
zval_ptr_dtor(&sxe->iter.data);
ZVAL_UNDEF(&sxe->iter.data);
Expand All @@ -2171,17 +2172,6 @@ static void sxe_object_dtor(zend_object *object)
zval_ptr_dtor(&sxe->tmp);
ZVAL_UNDEF(&sxe->tmp);
}
}
/* }}} */

/* {{{ sxe_object_free_storage() */
static void sxe_object_free_storage(zend_object *object)
{
php_sxe_object *sxe;

sxe = php_sxe_fetch_object(object);

zend_object_std_dtor(&sxe->zo);

php_libxml_node_decrement_resource((php_libxml_node_object *)sxe);

Expand Down Expand Up @@ -2691,7 +2681,6 @@ PHP_MINIT_FUNCTION(simplexml)

memcpy(&sxe_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
sxe_object_handlers.offset = XtOffsetOf(php_sxe_object, zo);
sxe_object_handlers.dtor_obj = sxe_object_dtor;
sxe_object_handlers.free_obj = sxe_object_free_storage;
sxe_object_handlers.clone_obj = sxe_object_clone;
sxe_object_handlers.read_property = sxe_property_read;
Expand Down

0 comments on commit cde735e

Please sign in to comment.