Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/dom/php_dom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ PHP_MINIT_FUNCTION(dom)
DOM_REGISTER_PROP_HANDLER(&dom_modern_attr_prop_handlers, "value", dom_attr_value_read, dom_attr_value_write);
DOM_REGISTER_PROP_HANDLER(&dom_modern_attr_prop_handlers, "ownerElement", dom_attr_owner_element_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_modern_attr_prop_handlers, "specified", dom_attr_specified_read, NULL);
zend_hash_merge(&dom_modern_attr_prop_handlers, &dom_node_prop_handlers, NULL, false);
zend_hash_merge(&dom_modern_attr_prop_handlers, &dom_modern_node_prop_handlers, NULL, false);
DOM_OVERWRITE_PROP_HANDLER(&dom_modern_attr_prop_handlers, "nodeValue", dom_node_node_value_read, dom_node_node_value_write);
DOM_OVERWRITE_PROP_HANDLER(&dom_modern_attr_prop_handlers, "textContent", dom_node_text_content_read, dom_node_text_content_write);
zend_hash_add_new_ptr(&classes, dom_modern_attr_class_entry->name, &dom_modern_attr_prop_handlers);
Expand Down Expand Up @@ -1194,7 +1194,7 @@ PHP_MINIT_FUNCTION(dom)
DOM_REGISTER_PROP_HANDLER(&dom_modern_documenttype_prop_handlers, "publicId", dom_documenttype_public_id_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_modern_documenttype_prop_handlers, "systemId", dom_documenttype_system_id_read, NULL);
DOM_REGISTER_PROP_HANDLER(&dom_modern_documenttype_prop_handlers, "internalSubset", dom_documenttype_internal_subset_read, NULL);
zend_hash_merge(&dom_modern_documenttype_prop_handlers, &dom_node_prop_handlers, NULL, false);
zend_hash_merge(&dom_modern_documenttype_prop_handlers, &dom_modern_node_prop_handlers, NULL, false);
zend_hash_add_new_ptr(&classes, dom_modern_documenttype_class_entry->name, &dom_modern_documenttype_prop_handlers);

dom_notation_class_entry = register_class_DOMNotation(dom_node_class_entry);
Expand Down
16 changes: 16 additions & 0 deletions ext/dom/tests/gh17397.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
GH-17397 (Assertion failure ext/dom/php_dom.c)
--EXTENSIONS--
dom
--FILE--
<?php
$dom = Dom\HTMLDocument::createFromString('<!DOCTYPE html><html></html>');
var_dump($dom->doctype->prefix);
echo $dom->saveXml();
?>
--EXPECTF--
Warning: Undefined property: Dom\DocumentType::$prefix in %s on line %d
NULL
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body></body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ foreach ($test_matrix as $test_item) {

?>
--EXPECT--
object(Dom\DocumentType)#3 (23) {
object(Dom\DocumentType)#3 (19) {
["name"]=>
string(5) "qname"
["entities"]=>
Expand All @@ -38,12 +38,14 @@ object(Dom\DocumentType)#3 (23) {
string(6) "system"
["internalSubset"]=>
NULL
["nodeType"]=>
int(10)
["nodeName"]=>
string(5) "qname"
["nodeValue"]=>
["baseURI"]=>
NULL
["nodeType"]=>
int(10)
["isConnected"]=>
bool(false)
["parentNode"]=>
NULL
["parentElement"]=>
Expand All @@ -58,25 +60,15 @@ object(Dom\DocumentType)#3 (23) {
NULL
["nextSibling"]=>
NULL
["attributes"]=>
NULL
["isConnected"]=>
bool(false)
["namespaceURI"]=>
NULL
["prefix"]=>
string(0) ""
["localName"]=>
NULL
["baseURI"]=>
["nodeValue"]=>
NULL
["textContent"]=>
string(0) ""
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE qname PUBLIC "public" "system">

object(Dom\DocumentType)#2 (23) {
object(Dom\DocumentType)#2 (19) {
["name"]=>
string(5) "qname"
["entities"]=>
Expand All @@ -89,12 +81,14 @@ object(Dom\DocumentType)#2 (23) {
string(0) ""
["internalSubset"]=>
NULL
["nodeType"]=>
int(10)
["nodeName"]=>
string(5) "qname"
["nodeValue"]=>
["baseURI"]=>
NULL
["nodeType"]=>
int(10)
["isConnected"]=>
bool(false)
["parentNode"]=>
NULL
["parentElement"]=>
Expand All @@ -109,25 +103,15 @@ object(Dom\DocumentType)#2 (23) {
NULL
["nextSibling"]=>
NULL
["attributes"]=>
NULL
["isConnected"]=>
bool(false)
["namespaceURI"]=>
NULL
["prefix"]=>
string(0) ""
["localName"]=>
NULL
["baseURI"]=>
["nodeValue"]=>
NULL
["textContent"]=>
string(0) ""
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE qname PUBLIC "public" "">

object(Dom\DocumentType)#1 (23) {
object(Dom\DocumentType)#1 (19) {
["name"]=>
string(5) "qname"
["entities"]=>
Expand All @@ -140,12 +124,14 @@ object(Dom\DocumentType)#1 (23) {
string(6) "system"
["internalSubset"]=>
NULL
["nodeType"]=>
int(10)
["nodeName"]=>
string(5) "qname"
["nodeValue"]=>
["baseURI"]=>
NULL
["nodeType"]=>
int(10)
["isConnected"]=>
bool(false)
["parentNode"]=>
NULL
["parentElement"]=>
Expand All @@ -160,25 +146,15 @@ object(Dom\DocumentType)#1 (23) {
NULL
["nextSibling"]=>
NULL
["attributes"]=>
NULL
["isConnected"]=>
bool(false)
["namespaceURI"]=>
NULL
["prefix"]=>
string(0) ""
["localName"]=>
NULL
["baseURI"]=>
["nodeValue"]=>
NULL
["textContent"]=>
string(0) ""
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE qname SYSTEM "system">

object(Dom\DocumentType)#4 (23) {
object(Dom\DocumentType)#4 (19) {
["name"]=>
string(5) "qname"
["entities"]=>
Expand All @@ -191,12 +167,14 @@ object(Dom\DocumentType)#4 (23) {
string(0) ""
["internalSubset"]=>
NULL
["nodeType"]=>
int(10)
["nodeName"]=>
string(5) "qname"
["nodeValue"]=>
["baseURI"]=>
NULL
["nodeType"]=>
int(10)
["isConnected"]=>
bool(false)
["parentNode"]=>
NULL
["parentElement"]=>
Expand All @@ -211,17 +189,7 @@ object(Dom\DocumentType)#4 (23) {
NULL
["nextSibling"]=>
NULL
["attributes"]=>
NULL
["isConnected"]=>
bool(false)
["namespaceURI"]=>
NULL
["prefix"]=>
string(0) ""
["localName"]=>
NULL
["baseURI"]=>
["nodeValue"]=>
NULL
["textContent"]=>
string(0) ""
Expand Down
28 changes: 10 additions & 18 deletions ext/dom/tests/modern/xml/DTDNamedNodeMap.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var_dump($doctype->notations["GIF"]);

?>
--EXPECTF--
object(Dom\DocumentType)#2 (24) {
object(Dom\DocumentType)#2 (20) {
["name"]=>
string(4) "root"
["entities"]=>
Expand All @@ -41,12 +41,16 @@ object(Dom\DocumentType)#2 (24) {
string(105) "<!ENTITY test "entity is only for test purposes">
<!ENTITY myimage PUBLIC "-" "mypicture.gif" NDATA GIF>
"
["nodeName"]=>
string(4) "root"
["nodeValue"]=>
NULL
["nodeType"]=>
int(10)
["nodeName"]=>
string(4) "root"
["baseURI"]=>
string(%d) "%s"
["isConnected"]=>
bool(true)
["ownerDocument"]=>
string(22) "(object value omitted)"
["parentNode"]=>
string(22) "(object value omitted)"
["parentElement"]=>
Expand All @@ -61,20 +65,8 @@ object(Dom\DocumentType)#2 (24) {
NULL
["nextSibling"]=>
string(22) "(object value omitted)"
["attributes"]=>
NULL
["isConnected"]=>
bool(true)
["ownerDocument"]=>
string(22) "(object value omitted)"
["namespaceURI"]=>
NULL
["prefix"]=>
string(0) ""
["localName"]=>
["nodeValue"]=>
NULL
["baseURI"]=>
string(%d) "%s"
["textContent"]=>
NULL
}
Expand Down
Loading