-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix spec compliance error for DOMDocument::getElementsByTagNameNS #11343
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
Spec link: https://dom.spec.whatwg.org/#concept-getelementsbytagnamens Spec says we should match any namespace when '*' is provided. This was however not the case: elements that didn't have a namespace were not returned. This patch fixes the error by modifying the namespace check.
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.
Not super familiar with the spec, and reading it at 11PM is not the best thing to do. But it looks reasonable, just not groking a couple of things
ext/dom/tests/DOMDocument_getElementsByTagNameNS_match_any_namespace.phpt
Show resolved
Hide resolved
ext/dom/php_dom.c
Outdated
/* Note: The spec says that ns == NULL should change the namespace to the empty string. | ||
* This is already done at the PHP_FUNCTIONs that create this iterator. | ||
* The null case here actually means we want to match any namespace instead. */ |
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.
So a NULL pointer can only happen via an internal call?
And the spec says
If namespace is the empty string, then set it to null.
Which seems to contradict this comment or am I missing something?
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.
So a NULL pointer can only happen via an internal call?
Yes it can only happen via an internal call.
Which seems to contradict this comment or am I missing something?
Errr oops, I meant to state they are equivalent.
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.
Okay I rewrote the comment to be more clear.
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.
LGTM if CI is happy
Spec link: https://dom.spec.whatwg.org/#concept-getelementsbytagnamens Spec says we should match any namespace when '*' is provided. This was however not the case: elements that didn't have a namespace were not returned. This patch fixes the error by modifying the namespace check.
Discovered while working on GH-11330.