-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix #79271: DOMDocumentType::$childNodes is NULL #5180
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
Dom level 2 core, DOM level 3 core and the DOM living standard agree that `childNodes` always return a `NodeList`, and never `null`.
intern = Z_DOMOBJ_P(retval); | ||
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL); | ||
} | ||
php_dom_create_interator(retval, DOM_NODELIST); |
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.
BTW, what's an "interator"?
cc @beberlei |
This is technically a BC break, but the likelihood of people working with |
Yes, that is a BC break, so maybe should target an higher branch? Anyway, these node types are affected as well. |
@theseer @ThomasWeinert can I loop you in for a comment? |
I think the change has little chance to break something. It would make a condition unnecessary (is the property a node list / not null) but in any case the user has to consider an empty node list. |
I basically agree with @ThomasWeinert. A Question is what the real world impact of this change or break would be though, as I don't believe there to be many active uses of But how many users does it have to affect before it's a BC break to avoid? ;-) |
Thanks everyone for the feedback! Applied the patch as 0966941. |
@cmb69 Derick reported a change in xdebug tests failing on 7.3, is this change related? I don't see how on the first glance. https://xdebug.org/ci?r=2020-24-24-03-20-01@7.3dev-zts |
Alternatively, maybe add a node to UPGRADING? Test fix: tests/base/bug00913.phpt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/base/bug00913.phpt b/tests/base/bug00913.phpt
index cd451134..3be71334 100644
--- a/tests/base/bug00913.phpt
+++ b/tests/base/bug00913.phpt
@@ -181,7 +181,7 @@ object(DOMText)#%d (%d) {
["parentNode"]=>
string(22) "(object value omitted)"
["childNodes"]=>
- NULL
+ string(22) "(object value omitted)"
["firstChild"]=>
NULL
["lastChild"]=> |
This isn't the only change in the test I think, there are also these:
|
@derickr, nope, these are otherwise catched by the |
In case it matters: I'd keep the - as stated before - minor BC break but adding a note might be a good idea never the less. |
UPGRADING note added with commit 49762c8. |
Dom level 2 core, DOM level 3 core and the DOM living standard agree
that
childNodes
always return aNodeList
, and nevernull
.