From: Nikita Popov Date: Thu, 17 Apr 2014 22:03:38 +0000 (+0200) Subject: Move libxml_destroy_fci to RSHUTDOWN X-Git-Tag: POST_PHPNG_MERGE~412^2~82^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c3c47c431ea301f8750dbdd1ced69a6cf365b3a1;p=php Move libxml_destroy_fci to RSHUTDOWN If this is only done in post shutdown and the function name is an object (e.g. closure), the object will already be freed during zend_deactivate. I left the rest of the shutdown procedure in post shutdown, as it presumably has a reason to be there... --- diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index d399f72b95..af87213a39 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -86,6 +86,7 @@ ZEND_GET_MODULE(libxml) /* {{{ function prototypes */ static PHP_MINIT_FUNCTION(libxml); static PHP_RINIT_FUNCTION(libxml); +static PHP_RSHUTDOWN_FUNCTION(libxml); static PHP_MSHUTDOWN_FUNCTION(libxml); static PHP_MINFO_FUNCTION(libxml); static int php_libxml_post_deactivate(); @@ -138,7 +139,7 @@ zend_module_entry libxml_module_entry = { PHP_MINIT(libxml), /* extension-wide startup function */ PHP_MSHUTDOWN(libxml), /* extension-wide shutdown function */ PHP_RINIT(libxml), /* per-request startup function */ - NULL, /* per-request shutdown function */ + PHP_RSHUTDOWN(libxml), /* per-request shutdown function */ PHP_MINFO(libxml), /* information function */ NO_VERSION_YET, PHP_MODULE_GLOBALS(libxml), /* globals descriptor */ @@ -862,6 +863,12 @@ static PHP_RINIT_FUNCTION(libxml) return SUCCESS; } +static PHP_RSHUTDOWN_FUNCTION(libxml) +{ + _php_libxml_destroy_fci(&LIBXML(entity_loader).fci, &LIBXML(entity_loader).object); + + return SUCCESS; +} static PHP_MSHUTDOWN_FUNCTION(libxml) { @@ -898,8 +905,6 @@ static int php_libxml_post_deactivate() } xmlResetLastError(); - _php_libxml_destroy_fci(&LIBXML(entity_loader).fci, &LIBXML(entity_loader).object); - return SUCCESS; } diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt index 51ab777052..938229ff86 100644 --- a/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt +++ b/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt @@ -31,6 +31,7 @@ var_dump($dd->validate()); echo "Done.\n"; +?> --EXPECT-- string(10) "-//FOO/BAR" string(25) "http://example.com/foobar"