Skip to content

Commit 73a4c50

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79271: DOMDocumentType::$childNodes is NULL
2 parents 8ec7636 + 0966941 commit 73a4c50

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ PHP NEWS
2020
- DOM:
2121
. Fixed bug #77569: (Write Access Violation in DomImplementation). (Nikita,
2222
cmb)
23+
. Fixed bug #79271 (DOMDocumentType::$childNodes is NULL). (cmb)
2324

2425
- PCRE:
2526
. Fixed bug #79188 (Memory corruption in preg_replace/preg_replace_callback

ext/dom/node.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,13 +431,9 @@ int dom_node_child_nodes_read(dom_object *obj, zval *retval)
431431
return FAILURE;
432432
}
433433

434-
if (dom_node_children_valid(nodep) == FAILURE) {
435-
ZVAL_NULL(retval);
436-
} else {
437-
php_dom_create_interator(retval, DOM_NODELIST);
438-
intern = Z_DOMOBJ_P(retval);
439-
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL);
440-
}
434+
php_dom_create_interator(retval, DOM_NODELIST);
435+
intern = Z_DOMOBJ_P(retval);
436+
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL);
441437

442438
return SUCCESS;
443439
}

ext/dom/tests/bug69846.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ object(DOMText)#%d (19) {
5050
["parentNode"]=>
5151
NULL
5252
["childNodes"]=>
53-
NULL
53+
string(22) "(object value omitted)"
5454
["firstChild"]=>
5555
NULL
5656
["lastChild"]=>
@@ -140,7 +140,7 @@ object(DOMText)#%d (19) {
140140
["parentNode"]=>
141141
NULL
142142
["childNodes"]=>
143-
NULL
143+
string(22) "(object value omitted)"
144144
["firstChild"]=>
145145
NULL
146146
["lastChild"]=>

ext/dom/tests/bug79271.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Bug #79271 (DOMDocumentType::$childNodes is NULL)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('dom')) die('skip dom extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
$dom = new DOMImplementation();
10+
$type = $dom->createDocumentType('html');
11+
var_dump($type->childNodes);
12+
?>
13+
--EXPECTF--
14+
object(DOMNodeList)#%d (1) {
15+
["length"]=>
16+
int(0)
17+
}

0 commit comments

Comments
 (0)