[php-src] PR #11576: Change the way how lifetimes work in ext/dom
| From: | nielsdos | Date: | Sun, 02 Jul 2023 17:04:01 +0000 |
| Subject: | [php-src] PR #11576: Change the way how lifetimes work in ext/dom | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-22873@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/11576
Author: nielsdos
Fixes GH-9628
Currently, when you remove a node from the DOM, that node will become inaccessible. This even
happens when the node is implicitly removed, even when you still hold a reference to it in a
variable. This is not possible to detect and prevent easily (see issue details).
This patch changes how lifetimes works. If there's still a userland reference, the node is
unlinked instead of freed.
This causes some complications because of how freeing works, especially because of some libxml2
peculiarities (see comments in the code).