[GIT-PULLS] [php-src] PR #23126: Fix GH-23115: stack overflow in compact() with deep arrays

[email protected] (lazerg)
Newsgroups php.git-pulls
Message-ID <qNQKBvWYeEfriIyAFKGd83FyHg06Lq6CTiZAGhV43iY@main.internal.php.net>
Pull Request: https://github.com/php/php-src/pull/23126
Author: lazerg

php_compact_var() recurses once per nesting level with no stack check, so passing a deeply nested array to compact() 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.

Fixes #23115.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.