[php-src] PR #23090: Fix GH-23088: Stack overflow when comparing deeply nested arrays
| From: | lazerg | Date: | Thu, 06 Aug 2026 14:02:56 +0000 |
| Subject: | [php-src] PR #23090: Fix GH-23088: Stack overflow when comparing deeply nested arrays | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37584@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23090
Author: lazerg
Comparing two deeply nested arrays with
== recurses through zend_compare
-> zend_compare_arrays -> zend_compare_symbol_tables ->
zend_hash_compare once per nesting level, and nothing bounds that recursion.
zend_hash_compare() only guards against cycles, so a non-cyclic array a few tens of
thousands of levels deep runs the C stack out and the process dies with a segfault.
zend_compare_symbol_tables() now checks the stack limit before descending and throws an
Error instead, the same way zend_std_compare_objects() already handles the
object case.
Fixes GH-23088