1--TEST-- 2ParentNode hierarchy exceptions with temporary and non-temporary text nodes 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = Dom\HTMLDocument::createEmpty(); 9 10try { 11 $dom->append("bar"); 12} catch (DOMException $e) { 13 echo "Exception: " . $e->getMessage() . "\n"; 14} 15 16try { 17 $dom->append($dom->createTextNode("bar")); 18} catch (DOMException $e) { 19 echo "Exception: " . $e->getMessage() . "\n"; 20} 21 22$text = $dom->createTextNode("bar"); 23try { 24 $dom->append($text); 25} catch (DOMException $e) { 26 echo "Exception: " . $e->getMessage() . "\n"; 27} 28 29var_dump($text->parentNode); 30var_dump($text->textContent); 31 32$element = $dom->createElement("container"); 33$text = $element->appendChild($dom->createTextNode("text")); 34try { 35 $dom->append($text); 36} catch (DOMException $e) { 37 echo "Exception: " . $e->getMessage() . "\n"; 38} 39 40?> 41--EXPECT-- 42Exception: Cannot insert text as a child of a document 43Exception: Cannot insert text as a child of a document 44Exception: Cannot insert text as a child of a document 45NULL 46string(3) "bar" 47Exception: Cannot insert text as a child of a document 48