[php-src] PR #22871: Guard var_dump()/debug_zval_dump() against native stack overflow
| From: | iliaal | Date: | Thu, 23 Jul 2026 14:05:20 +0000 |
| Subject: | [php-src] PR #22871: Guard var_dump()/debug_zval_dump() against native stack overflow | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37249@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22871
Author: iliaal
A deeply nested array or object passed to var_dump() or debug_zval_dump() overflows the native C
stack and segfaults. The object path of var_dump() and serialize() already guard their recursion
with ZEND_CHECK_STACK_LIMIT; the array element helper and both debug_zval_dump() helpers were
missing it. var_export() overflows the same way but needs a throw-based guard, left for a separate
change.
$a = [];
for ($i = 0; $i < 100000; $i++) { $a = [$a]; }
var_dump($a); // SIGSEGV before this change