1--TEST-- 2Test reading Element::${inner,outer}HTML on XML documents - error cases 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = DOM\XMLDocument::createEmpty(); 9 10function createContainer() { 11 global $dom; 12 $element = $dom->createElement("container"); 13 return $element; 14} 15 16function test($container) { 17 try { 18 var_dump($container->innerHTML); 19 } catch (DOMException $e) { 20 echo $e->getMessage(), "\n"; 21 } 22 try { 23 var_dump($container->outerHTML); 24 } catch (DOMException $e) { 25 echo $e->getMessage(), "\n"; 26 } 27} 28 29$container = createContainer(); 30$container->append("Hello, \x01 world!"); 31test($container); 32 33$container = createContainer(); 34$container->append($dom->createComment('Hello -- world')); 35test($container); 36 37$container = createContainer(); 38$container->append($dom->createComment('Hello world-')); 39test($container); 40 41$container = createContainer(); 42$container->append($dom->createComment('Hello world-')); 43test($container); 44 45$container = createContainer(); 46$container->append($dom->createComment("\x01")); 47test($container); 48 49$container = createContainer(); 50$legacy = new DOMDocument; 51$container->append($dom->importLegacyNode($legacy->createProcessingInstruction('foo:bar', '?>'))); 52test($container); 53 54$container = createContainer(); 55$legacy = new DOMDocument; 56$container->append($dom->importLegacyNode($legacy->createProcessingInstruction('foo', '?>'))); 57test($container); 58 59$container = createContainer(); 60$legacy = new DOMDocument; 61$container->append($dom->importLegacyNode($legacy->createProcessingInstruction('xml', ''))); 62test($container); 63 64$container = createContainer(); 65$legacy = new DOMDocument; 66$container->append($dom->importLegacyNode($legacy->createProcessingInstruction('foo', "\x01"))); 67test($container); 68 69$container = createContainer(); 70$container->append($dom->createElement("with:colon")); 71test($container); 72 73$container = createContainer(); 74$container->append($dom->createElementNS("http://www.w3.org/2000/xmlns/", "xmlns:colon")); 75test($container); 76 77$container = createContainer(); 78$element = $container->appendChild(createContainer()); 79$element->setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:x", "http://www.w3.org/2000/xmlns/"); 80test($container); 81 82$container = createContainer(); 83$element = $container->appendChild(createContainer()); 84$element->setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:x", ""); 85test($container); 86 87$container = createContainer(); 88$element = $container->appendChild(createContainer()); 89$element->setAttribute("with:colon", "value"); 90test($container); 91 92$container = createContainer(); 93$element = $container->appendChild(createContainer()); 94$element->setAttribute("xmlns", "value"); 95test($container); 96 97?> 98--EXPECT-- 99The resulting XML serialization is not well-formed 100The resulting XML serialization is not well-formed 101The resulting XML serialization is not well-formed 102The resulting XML serialization is not well-formed 103The resulting XML serialization is not well-formed 104The resulting XML serialization is not well-formed 105The resulting XML serialization is not well-formed 106The resulting XML serialization is not well-formed 107The resulting XML serialization is not well-formed 108The resulting XML serialization is not well-formed 109The resulting XML serialization is not well-formed 110The resulting XML serialization is not well-formed 111The resulting XML serialization is not well-formed 112The resulting XML serialization is not well-formed 113The resulting XML serialization is not well-formed 114The resulting XML serialization is not well-formed 115The resulting XML serialization is not well-formed 116The resulting XML serialization is not well-formed 117The resulting XML serialization is not well-formed 118The resulting XML serialization is not well-formed 119The resulting XML serialization is not well-formed 120The resulting XML serialization is not well-formed 121The resulting XML serialization is not well-formed 122The resulting XML serialization is not well-formed 123The resulting XML serialization is not well-formed 124The resulting XML serialization is not well-formed 125The resulting XML serialization is not well-formed 126The resulting XML serialization is not well-formed 127The resulting XML serialization is not well-formed 128The resulting XML serialization is not well-formed 129