[php-src] PR #11402: Fix #70359 and #78577

From: Date: Thu, 08 Jun 2023 20:28:31 +0000
Subject: [php-src] PR #11402: Fix #70359 and #78577
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-22694@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/11402 Author: nielsdos Fixes https://bugs.php.net/bug.php?id=70359 and https://bugs.php.net/bug.php?id=78577 It's a combination of two problems really. * There was some incorrect field setting, and weird code due to the casting and abuse of types. I solved this in one go by casting to the right type and using the correct fields. * We're creating a fake child, but adding the parent node to it. However, because the fake child is not part of the parent's node children list, it will not get destroyed together with the parent when the parent gets destroyed. The consequence is that if you remove the parent, instead of invalidating the attribute, it will cause a use-after-free. The only way I could think of to solve this is to get an additional reference to the parent. Implementation-wise this was simply a matter of adding a custom constructor and destructor handler for the DOMNamespaceNode. I've broken up the PR into individual commits to make it easier to follow for reviews. Will squash upon merge.

« previous php.git-pulls (#22694) next »