1--TEST-- 2Manually call __construct() - entity reference variation 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$entityRef = new DOMEntityReference('foo'); 9var_dump($entityRef->nodeName, $entityRef->textContent); 10$entityRef->__construct('foo2'); 11var_dump($entityRef->nodeName, $entityRef->textContent); 12 13$doc = new DOMDocument(); 14$doc->loadXML(<<<XML 15<?xml version="1.0"?> 16<container/> 17XML); 18$doc->documentElement->appendChild($entityRef); 19echo $doc->saveXML(); 20 21$entityRef->__construct('foo3'); 22$doc->documentElement->appendChild($entityRef); 23echo $doc->saveXML(); 24 25?> 26--EXPECT-- 27string(3) "foo" 28string(0) "" 29string(4) "foo2" 30string(0) "" 31<?xml version="1.0"?> 32<container>&foo2;</container> 33<?xml version="1.0"?> 34<container>&foo2;&foo3;</container> 35