--TEST-- $innerHTML cache invalidation --EXTENSIONS-- dom --FILE-- '); $els = $dom->getElementsByTagName('a'); var_dump($els[0]->tagName); $dom->documentElement->innerHTML = ''; echo $dom->saveXML(), "\n"; var_dump($els); var_dump($els[0]?->tagName); ?> --EXPECT-- string(1) "a" object(Dom\HTMLCollection)#2 (1) { ["length"]=> int(0) } NULL