1--TEST-- 2Dom\HTMLDocument::registerNodeClass 02 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8class Custom extends Dom\Document { 9 public function foo() { 10 } 11} 12 13$dom = Dom\HTMLDocument::createEmpty(); 14try { 15 $dom->registerNodeClass("Dom\\Document", "Custom"); 16} catch (ValueError $e) { 17 echo $e->getMessage(), "\n"; 18} 19 20$element = $dom->appendChild($dom->createElement("foo")); 21unset($dom); 22 23var_dump(get_class($element->ownerDocument)); 24 25// Should fail 26$element->ownerDocument->foo(); 27 28?> 29--EXPECTF-- 30Dom\Document::registerNodeClass(): Argument #1 ($baseClass) must not be an abstract class 31string(16) "Dom\HTMLDocument" 32 33Fatal error: Uncaught Error: Call to undefined method Dom\HTMLDocument::foo() in %s:%d 34Stack trace: 35#0 {main} 36 thrown in %s on line %d 37