php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #61797
Patch dom_node_append_child.patch revision 2013-12-02 19:55 UTC by krakjoe@php.net
revision 2013-12-02 19:43 UTC by krakjoe@php.net

Patch dom_node_append_child.patch for DOM XML related Bug #61797

Patch version 2013-12-02 19:55 UTC

Return to Bug #61797 | Download this patch
Patch Revisions:

Developer: krakjoe@php.net

diff --git a/ext/dom/node.c b/ext/dom/node.c
index 3279567..a6b26c7 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -1386,9 +1386,11 @@ PHP_FUNCTION(dom_node_append_child)
 			RETURN_FALSE;
 		}
 	}
-
+	
+	zval_copy_ctor(node);
+	
 	dom_reconcile_ns(nodep->doc, new_child);
-
+	
 	DOM_RET_OBJ(new_child, &ret, intern);
 }
 /* }}} end dom_node_append_child */
diff --git a/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt b/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt
index a776654..9b7dbd3 100644
--- a/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt
+++ b/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt
@@ -14,10 +14,7 @@ $document->appendChild($root);
 $attr = $root->setAttribute('category', 'books');
 $document->removeChild($root);
 $root = null;
-var_dump($attr->ownerElement);
+var_dump(get_class($attr->ownerElement));
 ?>
 --EXPECTF--
-Warning: Couldn't fetch DOMAttr. Node no longer exists in %s on line %d
-
-Notice: Undefined property: DOMAttr::$ownerElement in %s on line %d
-NULL
+string(10) "DOMElement"
diff --git a/ext/dom/tests/regsiter_node_class.phpt b/ext/dom/tests/regsiter_node_class.phpt
index c632c61..ddc5598 100644
--- a/ext/dom/tests/regsiter_node_class.phpt
+++ b/ext/dom/tests/regsiter_node_class.phpt
@@ -15,7 +15,7 @@ class myElement extends DOMElement {
 $doc = new DOMDocument();
 $doc->registerNodeClass('DOMAttr', 'myAttribute');
 $doc->registerNodeClass('DOMElement', 'myElement');
-$doc->appendChild(new DOMElement('root'));
+$doc->appendChild(new myElement('root'));
 $root = $doc->documentElement;
 $root->setAttribute('a', 'a1');
 echo get_class($root), "\n";
@@ -30,11 +30,10 @@ echo get_class($attr), "\n";
 print $attr->testit()."\n";
 ?>
 --EXPECTF--
-
 myElement
 HELLO Element
 myAttribute
 HELLO Attribute
 DOMAttr
 
-Fatal error: Call to undefined method DOMAttr::testit() in %s on line 25
+Fatal error: Call to undefined method DOMAttr::testit() in %s on line %d
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 03:01:28 2024 UTC