Fix GH-23120: DOMNode::isEqualNode stack overflow on deeply nested trees - #23140
Merged
Conversation
Member
|
I would rather prefer you control the stack limit ; also, for once, the CI arm issue is very related (timeout?). |
devnexen
reviewed
Aug 8, 2026
| ZEND_ASSERT(other != NULL); | ||
|
|
||
| if (UNEXPECTED(php_dom_node_is_equal_node_check_stack_limit())) { | ||
| zend_throw_error(NULL, "Maximum call stack size reached. Infinite recursion?"); |
Member
There was a problem hiding this comment.
it needs to be gated with the exception global.
devnexen
approved these changes
Aug 8, 2026
ndossche
reviewed
Aug 8, 2026
|
|
||
| if (UNEXPECTED(php_dom_node_is_equal_node_check_stack_limit())) { | ||
| if (!EG(exception)) { | ||
| zend_throw_error(NULL, "Maximum call stack size reached. Infinite recursion?"); |
Member
There was a problem hiding this comment.
This can't be infinite recursion because a tree is an acyclic graph
Suggested change
| zend_throw_error(NULL, "Maximum call stack size reached. Infinite recursion?"); | |
| zend_throw_error(NULL, "Maximum call stack size reached."); |
Member
Author
There was a problem hiding this comment.
This is correct! I copy-paste this message from the last fix #23127 and I overlook this. Thx
NickSdot
pushed a commit
to NickSdot/php__php-src
that referenced
this pull request
Aug 8, 2026
* PHP-8.4: Fix phpGH-23120: DOMNode::isEqualNode stack overflow on deeply nested trees (php#23140)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DOMNode::isEqualNode() recursively compared ordered child lists.
Compare each node without descending into its children first to solve this and we walk both subtrees in tree order to compare descendants iteratively.
Fix GH-23120