[php-src] PR #25790: Fix a SimpleXMLElement cycle through a by-reference property never being collected

From: Date: Thu, 26 Nov 2026 15:33:51 +0000
Subject: [php-src] PR #25790: Fix a SimpleXMLElement cycle through a by-reference property never being collected
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41058@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25790 Author: lacatoire sxe_get_gc() does not expose sxe->tmp to the cycle collector. That zval is handed out by reference for a missing element and can hold the element itself, so such a cycle is never collected (a debug build reports it as a leak at the end of the request). Add it to the GC buffer. ### To reproduce ```php <?php $x = simplexml_load_string('<r/>'); $w = WeakReference::create($x); $r = &$x->n; $r = $x; unset($r, $x); gc_collect_cycles(); var_dump($w->get() !== null); ``` Before (PHP 8.4.28): ``` bool(true) ``` After: ``` bool(false) ```

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