]> granicus.if.org Git - php/commitdiff
Move libxml_destroy_fci to RSHUTDOWN
authorNikita Popov <nikic@php.net>
Thu, 17 Apr 2014 22:03:38 +0000 (00:03 +0200)
committerNikita Popov <nikic@php.net>
Thu, 17 Apr 2014 22:15:13 +0000 (00:15 +0200)
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...

ext/libxml/libxml.c
ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt

index d399f72b95eba1083412a1ede8c60fcf1ace7cac..af87213a399d7e74b2b449d6d408c08e0a23bc16 100644 (file)
@@ -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;
 }
 
index 51ab7770528a425802abe60ca88a7adb64ce1be9..938229ff86933609c734e98c1ac9e10119bc45f6 100644 (file)
@@ -31,6 +31,7 @@ var_dump($dd->validate());
 
 echo "Done.\n";
 
+?>
 --EXPECT--
 string(10) "-//FOO/BAR"
 string(25) "http://example.com/foobar"