summaryrefslogtreecommitdiff
path: root/ext/dom/php_dom.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom/php_dom.c')
-rw-r--r--ext/dom/php_dom.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index c78c6c2426..bbccaf0521 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -37,6 +37,8 @@
#define PHP_XPATH 1
#define PHP_XPTR 2
+extern int xml_parser_inited;
+
zend_object_handlers dom_object_handlers;
static HashTable classes;
@@ -542,8 +544,10 @@ PHP_MINIT_FUNCTION(dom)
REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT);
-
- xmlInitParser();
+ if (!xml_parser_inited) {
+ xmlInitThreads();
+ xml_parser_inited = 1;
+ }
return SUCCESS;
}
@@ -571,7 +575,10 @@ PHP_MINFO_FUNCTION(dom)
PHP_MSHUTDOWN_FUNCTION(dom)
{
- xmlCleanupParser();
+ if (xml_parser_inited) {
+ xmlCleanupParser();
+ xml_parser_inited = 0;
+ }
zend_hash_destroy(&dom_domstringlist_prop_handlers);
zend_hash_destroy(&dom_namelist_prop_handlers);