[php-src] PR #23125: Fix GH-23111: stack overflow in array_walk_recursive() with deep arrays
| From: | lazerg | Date: | Sat, 08 Aug 2026 04:31:56 +0000 |
| Subject: | [php-src] PR #23125: Fix GH-23111: stack overflow in array_walk_recursive() with deep arrays | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37633@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23125
Author: lazerg
php_array_walk() recurses once per nesting level with no stack check, so array_walk_recursive() on a
deeply nested array exhausts the native stack and the process dies with a segfault.
This adds the same stack limit check ext/standard already uses in var.c and http.c, so the call
throws an Error instead of crashing. The existing GC_IS_RECURSIVE guard only covers self-referential
arrays, not plain deep nesting.
Fixes #23111.