1--TEST-- 2Dom\HTMLDocument should retain properties and ownerDocument relation 01 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8class MyElement extends Dom\HTMLElement {} 9 10$dom = Dom\HTMLDocument::createFromString("<p>foo</p>", LIBXML_NOERROR); 11$dom->registerNodeClass("Dom\\HTMLElement", "MyElement"); 12 13// Destroy reference to the DOM 14$child = $dom->documentElement; 15unset($dom); 16 17// Regain reference using the ownerDocument property 18// Should be a Dom\HTMLDocument 19$dom = $child->ownerDocument; 20var_dump($dom); 21// Test if property is preserved (any random doc_props property will do) 22var_dump(get_class($dom->getElementsByTagName("p")->item(0))); 23 24?> 25--EXPECT-- 26object(Dom\HTMLDocument)#1 (28) { 27 ["implementation"]=> 28 string(22) "(object value omitted)" 29 ["URL"]=> 30 string(11) "about:blank" 31 ["documentURI"]=> 32 string(11) "about:blank" 33 ["characterSet"]=> 34 string(5) "UTF-8" 35 ["charset"]=> 36 string(5) "UTF-8" 37 ["inputEncoding"]=> 38 string(5) "UTF-8" 39 ["doctype"]=> 40 NULL 41 ["documentElement"]=> 42 string(22) "(object value omitted)" 43 ["firstElementChild"]=> 44 string(22) "(object value omitted)" 45 ["lastElementChild"]=> 46 string(22) "(object value omitted)" 47 ["childElementCount"]=> 48 int(1) 49 ["body"]=> 50 string(22) "(object value omitted)" 51 ["head"]=> 52 string(22) "(object value omitted)" 53 ["title"]=> 54 string(0) "" 55 ["nodeType"]=> 56 int(13) 57 ["nodeName"]=> 58 string(9) "#document" 59 ["baseURI"]=> 60 string(11) "about:blank" 61 ["isConnected"]=> 62 bool(true) 63 ["ownerDocument"]=> 64 NULL 65 ["parentNode"]=> 66 NULL 67 ["parentElement"]=> 68 NULL 69 ["childNodes"]=> 70 string(22) "(object value omitted)" 71 ["firstChild"]=> 72 string(22) "(object value omitted)" 73 ["lastChild"]=> 74 string(22) "(object value omitted)" 75 ["previousSibling"]=> 76 NULL 77 ["nextSibling"]=> 78 NULL 79 ["nodeValue"]=> 80 NULL 81 ["textContent"]=> 82 NULL 83} 84string(9) "MyElement" 85