[php-src] PR #21494: Fix GH-15869: Stack overflow in zend_array_destroy with deeply nested arrays

From: Date: Mon, 23 Mar 2026 01:05:11 +0000
Subject: [php-src] PR #21494: Fix GH-15869: Stack overflow in zend_array_destroy with deeply nested arrays
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-35307@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/21494 Author: iliaal ## Summary - zend_array_destroy() recurses via i_zval_ptr_dtor for each element, overflowing the C stack at ~40-50k nesting levels - Applies a tail-call optimization: when an element is an array with refcount reaching zero, defer its destruction and loop back instead of recursing - Linear chains (the crash scenario, e.g. $a = [$a] in a loop) now use zero stack depth regardless of nesting - Arrays with multiple nested children recurse per-branch, each independently benefiting from the same optimization Fixes #15869

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