File tree 2 files changed +6
-1
lines changed
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1467,7 +1467,7 @@ static zend_string *dom_get_child_text_content(const xmlNode *node)
1467
1467
1468
1468
const xmlNode * text = node -> children ;
1469
1469
while (text != NULL ) {
1470
- if (text -> type == XML_TEXT_NODE || text -> type == XML_CDATA_SECTION_NODE ) {
1470
+ if (( text -> type == XML_TEXT_NODE || text -> type == XML_CDATA_SECTION_NODE ) && text -> content != NULL ) {
1471
1471
smart_str_appends (& content , (const char * ) text -> content );
1472
1472
}
1473
1473
text = text -> next ;
Original file line number Diff line number Diff line change @@ -43,6 +43,10 @@ var_dump($dom->title);
43
43
$ dom = Dom \XMLDocument::createFromString ("<root xmlns= \"http://www.w3.org/1999/xhtml \"><title>title \nhere</title></root> " );
44
44
var_dump ($ dom ->title );
45
45
46
+ $ dom = Dom \XMLDocument::createFromString ("<root xmlns= \"http://www.w3.org/1999/xhtml \"><title/></root> " );
47
+ $ dom ->getElementsByTagName ('title ' )[0 ]->appendChild ($ dom ->importLegacyNode (new DOMText ));
48
+ var_dump ($ dom ->title );
49
+
46
50
echo "=== SVG namespaced root === \n" ;
47
51
48
52
$ dom = Dom \XMLDocument::createFromString ("<root xmlns= \"http://www.w3.org/1999/xhtml \"><title>title</title></root> " );
@@ -72,6 +76,7 @@ string(0) ""
72
76
string(2) "xz"
73
77
string(2) "yw"
74
78
string(10) "title here"
79
+ string(0) ""
75
80
=== SVG namespaced root ===
76
81
string(5) "title"
77
82
string(5) "title"
You can’t perform that action at this time.
0 commit comments