-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Refactor implementation of DOM nodelists, named maps, and iterators #18892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Use ecalloc() to not miss initializing any field. - Merge declarations and assignments.
@@ -22,7 +22,7 @@ foreach ($test_values as $value) { | |||
?> | |||
--EXPECTF-- | |||
--- -1 --- | |||
string(1) "a" | |||
string(3) "N/A" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The refactor actually fixed a bug here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not backport this as this is a very invasive fix.
The code was really messy with lots of checks and inconsistencies. This splits everything up into different functions and now everything is relayed to a handler vtable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can at least somewhat follow the new code compared to the old one.
So if the tests all pass then good for me :D
} | ||
|
||
void php_dom_named_node_map_get_named_item_into_zval(dom_nnodemap_object *objmap, const zend_string *named, zval *return_value) | ||
void php_dom_named_node_map_get_named_item_into_zval(dom_nnodemap_object *objmap, const zend_string *named, const char *ns, zval *return_value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense as a follow-up refactoring to have the namespace be a zend_string instead of a char pointer? Got my answer does not make sense as this is just passed down to libxml.
@@ -22,7 +22,7 @@ foreach ($test_values as $value) { | |||
?> | |||
--EXPECTF-- | |||
--- -1 --- | |||
string(1) "a" | |||
string(3) "N/A" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not backport this as this is a very invasive fix.
See individual commits.
This is a prerequisite for the
$children
property and for #18550I will follow up with a PR that moves some functions to the right files.