[php-src] PR #22390: Fix GH-20404: crash when modifying weak references during destruction
| From: | khaledalam | Date: | Sun, 21 Jun 2026 20:09:56 +0000 |
| Subject: | [php-src] PR #22390: Fix GH-20404: crash when modifying weak references during destruction | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36540@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22390
Author: khaledalam
Fixes GH-20404. Supersedes the stale #20655.
zend_weakrefs_notify() cleared weak references by iterating EG(weakrefs) in place.
Clearing an entry can run a user destructor that reentrantly registers (grows/reallocates the HT
mid-iteration → UAF) or unregisters pending entries.
Reworked to pop one entry at a time, never holding a cursor across user code. Handles both the
new-registration crash and the existing nested-WeakMap unregistration path.