}
}
- if (XML_DOCUMENT_NODE == node->parent->type) {
+ if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) {
int bytes;
bytes = xmlSaveFile(filename, (xmlDocPtr) sxe->document->ptr);
if (bytes == -1) {
node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
if (node) {
- if (XML_DOCUMENT_NODE == node->parent->type) {
+ if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) {
xmlDocDumpMemory((xmlDocPtr) sxe->document->ptr, &strval, &strval_len);
RETVAL_STRINGL((char *)strval, strval_len, 1);
xmlFree(strval);
}
if (sxe->node) {
nodep = xmlDocCopyNode(sxe->node->node, docp, 1);
- nodep->parent = sxe->node->node->parent;
}
php_libxml_increment_node_ptr((php_libxml_node_object *)clone, nodep, NULL TSRMLS_CC);
"
}
-string(55) "<?xml version="1.0" encoding="utf-8"?>
-<test>
+string(15) "<test>
-</test>
-"
+</test>"
Done
--UEXPECTF--
object(SimpleXMLElement)#%d (1) {
"
}
-string(55) "<?xml version="1.0" encoding="utf-8"?>
-<test>
+string(15) "<test>
-</test>
-"
+</test>"
Done