--TEST-- GH-11290 (DOMElement::replaceWith causes crash) --EXTENSIONS-- dom --FILE--

Loremipsumdolor

HTML; $dom = new DOMDocument(); $dom->loadHTML($html); $spans = iterator_to_array($dom->getElementsByTagName('span')->getIterator()); foreach ($spans as $span) { if ('unwrap_me' === $span->getAttribute('class')) { $span->replaceWith(...$span->childNodes); } } var_dump(str_replace("\n", "", $dom->saveHTML())); ?> --EXPECT-- string(67) "

Loremipsumdolor

"