--TEST-- DOMDocument node list item cache invalidation --EXTENSIONS-- dom --FILE-- loadHTML('
hello
world
'); $elements = $doc->getElementsByTagName('p'); $elements->item(0); // Activate item cache $doc->loadHTML('A
B
C
'); var_dump($elements); var_dump($elements->item(0)->textContent); // First lookup var_dump($elements->item(2)->textContent); // Uses cache var_dump($elements->item(1)->textContent); // Does not use cache echo "-- Remove cached item test --\n"; $doc = new DOMDocument(); $doc->loadHTML('hello
world
!
'); $elements = $doc->getElementsByTagName('p'); $item = $elements->item(0); // Activate item cache var_dump($item->textContent); $item->remove(); // Now element 0 means "world", and 1 means "!" unset($item); $item = $elements->item(1); var_dump($item->textContent); echo "-- Removal of cached item in loop test --\n"; $doc = new DOMDocument; $doc->loadXML( '