1--TEST-- 2Bug #79701 (getElementById does not correctly work with duplicate definitions) - prepending variation 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7$dom = new DOMDocument(); 8$root = $dom->createElement('html'); 9$dom->appendChild($root); 10 11$el1 = $dom->createElement('p1'); 12$el1->setAttribute('id', 'foo'); 13$el1->setIdAttribute('id', true); 14 15$root->appendChild($el1); 16 17$el2 = $dom->createElement('p2'); 18$el2->setAttribute('id', 'foo'); 19$el2->setIdAttribute('id', true); 20 21$root->appendChild($el2); 22unset($el1, $el2); 23 24$root->removeChild($dom->getElementById('foo')); 25 26var_dump($dom->getElementById('foo')?->nodeName); 27?> 28--EXPECT-- 29string(2) "p2" 30