diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 9c1dc5f61d391..6f9d87feebfb4 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -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); @@ -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); diff --git a/ext/dom/tests/gh17397.phpt b/ext/dom/tests/gh17397.phpt new file mode 100644 index 0000000000000..83d7beab90761 --- /dev/null +++ b/ext/dom/tests/gh17397.phpt @@ -0,0 +1,16 @@ +--TEST-- +GH-17397 (Assertion failure ext/dom/php_dom.c) +--EXTENSIONS-- +dom +--FILE-- +'); +var_dump($dom->doctype->prefix); +echo $dom->saveXml(); +?> +--EXPECTF-- +Warning: Undefined property: Dom\DocumentType::$prefix in %s on line %d +NULL + + + diff --git a/ext/dom/tests/modern/spec/Document_implementation_createDocumentType.phpt b/ext/dom/tests/modern/spec/Document_implementation_createDocumentType.phpt index 88c66abf09c91..bfb150b5cca89 100644 --- a/ext/dom/tests/modern/spec/Document_implementation_createDocumentType.phpt +++ b/ext/dom/tests/modern/spec/Document_implementation_createDocumentType.phpt @@ -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"]=> @@ -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"]=> @@ -58,17 +60,7 @@ 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) "" @@ -76,7 +68,7 @@ object(Dom\DocumentType)#3 (23) { -object(Dom\DocumentType)#2 (23) { +object(Dom\DocumentType)#2 (19) { ["name"]=> string(5) "qname" ["entities"]=> @@ -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"]=> @@ -109,17 +103,7 @@ 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) "" @@ -127,7 +111,7 @@ object(Dom\DocumentType)#2 (23) { -object(Dom\DocumentType)#1 (23) { +object(Dom\DocumentType)#1 (19) { ["name"]=> string(5) "qname" ["entities"]=> @@ -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"]=> @@ -160,17 +146,7 @@ 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) "" @@ -178,7 +154,7 @@ object(Dom\DocumentType)#1 (23) { -object(Dom\DocumentType)#4 (23) { +object(Dom\DocumentType)#4 (19) { ["name"]=> string(5) "qname" ["entities"]=> @@ -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"]=> @@ -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) "" diff --git a/ext/dom/tests/modern/xml/DTDNamedNodeMap.phpt b/ext/dom/tests/modern/xml/DTDNamedNodeMap.phpt index c94dce263efd2..fb0853939f88e 100644 --- a/ext/dom/tests/modern/xml/DTDNamedNodeMap.phpt +++ b/ext/dom/tests/modern/xml/DTDNamedNodeMap.phpt @@ -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"]=> @@ -41,12 +41,16 @@ object(Dom\DocumentType)#2 (24) { string(105) " " - ["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"]=> @@ -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 }