From: Alexander Ebert Date: Mon, 12 Apr 2021 17:21:21 +0000 (+0200) Subject: Avoid updates to DOMNodeList for childNodes X-Git-Tag: 5.3.6~9^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0d369d74165054b5801fe4a7fbad17400d48effa;p=GitHub%2FWoltLab%2FWCF.git Avoid updates to DOMNodeList for childNodes --- diff --git a/wcfsetup/install/files/lib/util/DOMUtil.class.php b/wcfsetup/install/files/lib/util/DOMUtil.class.php index 52c4607727..238d5a1f24 100644 --- a/wcfsetup/install/files/lib/util/DOMUtil.class.php +++ b/wcfsetup/install/files/lib/util/DOMUtil.class.php @@ -483,8 +483,13 @@ final class DOMUtil { throw new \InvalidArgumentException("Preserving child nodes is only supported for DOMElement."); } - while ($node->hasChildNodes()) { - self::insertBefore($node->childNodes->item(0), $node); + $children = []; + foreach ($node->childNodes as $childNode) { + $children[] = $childNode; + } + + foreach ($children as $child) { + self::insertBefore($child, $node); } }