From: Rob Richards Date: Fri, 13 Aug 2004 11:38:03 +0000 (+0000) Subject: Fixed bug #29599 (domxml_error segfaults another apache module) X-Git-Tag: php-4.3.9RC2~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11d323faaeafcb9dac1ec306493320a55ceb10df;p=php Fixed bug #29599 (domxml_error segfaults another apache module) --- diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index c5d830b8b6..35b473c9f1 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -540,8 +540,8 @@ zend_module_entry domxml_module_entry = { domxml_functions, PHP_MINIT(domxml), PHP_MSHUTDOWN(domxml), - NULL, - NULL, + PHP_RINIT(domxml), + PHP_RSHUTDOWN(domxml), PHP_MINFO(domxml), DOMXML_API_VERSION, /* Extension versionnumber */ STANDARD_MODULE_PROPERTIES @@ -1510,6 +1510,24 @@ static void domxml_error_validate(void *ctx, const char *msg, ...) } +PHP_RINIT_FUNCTION(domxml) +{ + xmlSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error); +#if HAVE_DOMXSLT + xsltSetGenericErrorFunc(xsltGenericErrorContext, (xmlGenericErrorFunc)domxml_error); +#endif + return SUCCESS; +} + +PHP_RSHUTDOWN_FUNCTION(domxml) +{ + xmlSetGenericErrorFunc(xmlGenericErrorContext, NULL); +#if HAVE_DOMXSLT + xsltSetGenericErrorFunc(xsltGenericErrorContext, NULL); +#endif + return SUCCESS; +} + PHP_MSHUTDOWN_FUNCTION(domxml) { #if HAVE_DOMXSLT @@ -1668,15 +1686,9 @@ PHP_MINIT_FUNCTION(domxml) REGISTER_LONG_CONSTANT("DOMXML_LOAD_SUBSTITUTE_ENTITIES", DOMXML_LOAD_SUBSTITUTE_ENTITIES, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("DOMXML_LOAD_COMPLETE_ATTRS",DOMXML_LOAD_COMPLETE_ATTRS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("DOMXML_LOAD_DONT_KEEP_BLANKS",DOMXML_LOAD_DONT_KEEP_BLANKS, CONST_CS | CONST_PERSISTENT); - xmlSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error); -#if (defined(LIBXML_THREAD_ENABLED) && LIBXML_VERSION >= 20511) - xmlThrDefSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error); -#endif -#if HAVE_DOMXSLT - xsltSetGenericErrorFunc(xsltGenericErrorContext, (xmlGenericErrorFunc)domxml_error); -#if HAVE_DOMEXSLT + +#if HAVE_DOMXSLT && HAVE_DOMEXSLT exsltRegisterAll(); -#endif #endif xmlInitParser(); return SUCCESS; diff --git a/ext/domxml/php_domxml.h b/ext/domxml/php_domxml.h index 90f3a022ac..33ebd6ac47 100644 --- a/ext/domxml/php_domxml.h +++ b/ext/domxml/php_domxml.h @@ -75,6 +75,8 @@ PHPAPI zval *php_domobject_new(xmlNodePtr obj, int *found, zval* in TSRMLS_DC); /* directory functions */ PHP_MINIT_FUNCTION(domxml); PHP_MSHUTDOWN_FUNCTION(domxml); +PHP_RINIT_FUNCTION(domxml); +PHP_RSHUTDOWN_FUNCTION(domxml); PHP_MINFO_FUNCTION(domxml); PHP_FUNCTION(domxml_version); PHP_FUNCTION(xmldoc);