[php-src] PR #11363: Fix bug #81642: DOMChildNode::replaceWith() bug when replacing a node with itself
| From: | nielsdos | Date: | Sat, 03 Jun 2023 16:11:09 +0000 |
| Subject: | [php-src] PR #11363: Fix bug #81642: DOMChildNode::replaceWith() bug when replacing a node with itself | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-22648@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/11363
Author: nielsdos
Needs (and based on) PR GH-11362 . I will rebase this once that PR is merged.
Fixes [#81642](https://bugs.php.net/bug.php?id=81642)
After the fixes I did recently, the above bug no longer hangs, but still produces the wrong result
for the first case. This is because the algorithm that is used for replaceWith isn't entirely
correct: if the node becomes a part of the fragment, then removing the node actually removes the
fragment. This results in the sudden removal of the node instead of replacing it.
I had to move some code around to be able to detect this.