summaryrefslogtreecommitdiff
path: root/ext/libxml/libxml.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/libxml/libxml.c')
-rw-r--r--ext/libxml/libxml.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 77a3df64a3..a6e68a21df 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -400,9 +400,6 @@ PHP_LIBXML_API void php_libxml_initialize() {
php_libxml_streams_IO_write,
php_libxml_streams_IO_close);
- /* report errors via handler rather than stderr */
- xmlSetGenericErrorFunc(NULL, php_libxml_error_handler);
-
zend_hash_init(&php_libxml_exports, 0, NULL, NULL, 1);
_php_libxml_initialized = 1;
@@ -411,8 +408,6 @@ PHP_LIBXML_API void php_libxml_initialize() {
PHP_LIBXML_API void php_libxml_shutdown() {
if (_php_libxml_initialized) {
- /* reset libxml generic error handling */
- xmlSetGenericErrorFunc(NULL, NULL);
xmlCleanupParser();
zend_hash_destroy(&php_libxml_exports);
_php_libxml_initialized = 0;
@@ -436,6 +431,9 @@ PHP_MINIT_FUNCTION(libxml)
PHP_RINIT_FUNCTION(libxml)
{
+ /* report errors via handler rather than stderr */
+ xmlSetGenericErrorFunc(NULL, php_libxml_error_handler);
+
return SUCCESS;
}
@@ -450,6 +448,9 @@ PHP_MSHUTDOWN_FUNCTION(libxml)
PHP_RSHUTDOWN_FUNCTION(libxml)
{
+ /* reset libxml generic error handling */
+ xmlSetGenericErrorFunc(NULL, NULL);
+
smart_str_free(&LIBXML(error_buffer));
return SUCCESS;
}