diff --git a/ext/dom/document.c b/ext/dom/document.c index 6489510615a..aaa5d58d90f 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -790,7 +790,7 @@ PHP_FUNCTION(dom_document_create_element_ns) zval *id, *rv = NULL; xmlDocPtr docp; xmlNodePtr nodep = NULL; - xmlNsPtr nsptr; + xmlNsPtr nsptr = NULL; int ret, uri_len = 0, name_len = 0; char *uri, *name; char *localname = NULL, *prefix = NULL; diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c index dd255a21ce9..6eb11863cb9 100644 --- a/ext/dom/domimplementation.c +++ b/ext/dom/domimplementation.c @@ -152,6 +152,8 @@ PHP_FUNCTION(dom_domimplementation_create_document) php_error_docref(NULL TSRMLS_CC, E_WARNING, "DocumentType: Wrong Document"); RETURN_FALSE; } + } else { + doctobj = NULL; } if (name_len > 0) { @@ -216,7 +218,7 @@ PHP_FUNCTION(dom_domimplementation_create_document) DOM_RET_OBJ(rv, (xmlNodePtr) docp, &ret, NULL); - if (doctype != NULL) { + if (doctobj != NULL) { doctobj->document = ((dom_object *)((node_ptr *)docp->_private)->_private)->document; increment_document_reference(doctobj, docp TSRMLS_CC); }