mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix GH-17397: Assertion failure ext/dom/php_dom.c
The problem was that the property hash tables were not merging the correct ones, a stupid typo (or caused by merging). Closes GH-17406.
This commit is contained in:
parent
71493623f4
commit
6d215981b6
5 changed files with 63 additions and 84 deletions
3
NEWS
3
NEWS
|
@ -6,6 +6,9 @@ PHP NEWS
|
|||
. Fixed bug GH-17234 (Numeric parent hook call fails with assertion).
|
||||
(nielsdos)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug GH-17397 (Assertion failure ext/dom/php_dom.c). (nielsdos)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug GH-16800 (ftp functions can abort with EINTR). (nielsdos)
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
16
ext/dom/tests/gh17397.phpt
Normal file
16
ext/dom/tests/gh17397.phpt
Normal file
|
@ -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>
|
|
@ -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
|
||||
["nodeName"]=>
|
||||
string(5) "qname"
|
||||
["nodeValue"]=>
|
||||
NULL
|
||||
["nodeType"]=>
|
||||
int(10)
|
||||
["nodeName"]=>
|
||||
string(5) "qname"
|
||||
["baseURI"]=>
|
||||
NULL
|
||||
["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) {
|
|||
<?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"]=>
|
||||
|
@ -89,12 +81,14 @@ object(Dom\DocumentType)#2 (23) {
|
|||
string(0) ""
|
||||
["internalSubset"]=>
|
||||
NULL
|
||||
["nodeName"]=>
|
||||
string(5) "qname"
|
||||
["nodeValue"]=>
|
||||
NULL
|
||||
["nodeType"]=>
|
||||
int(10)
|
||||
["nodeName"]=>
|
||||
string(5) "qname"
|
||||
["baseURI"]=>
|
||||
NULL
|
||||
["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) {
|
|||
<?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"]=>
|
||||
|
@ -140,12 +124,14 @@ object(Dom\DocumentType)#1 (23) {
|
|||
string(6) "system"
|
||||
["internalSubset"]=>
|
||||
NULL
|
||||
["nodeName"]=>
|
||||
string(5) "qname"
|
||||
["nodeValue"]=>
|
||||
NULL
|
||||
["nodeType"]=>
|
||||
int(10)
|
||||
["nodeName"]=>
|
||||
string(5) "qname"
|
||||
["baseURI"]=>
|
||||
NULL
|
||||
["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) {
|
|||
<?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"]=>
|
||||
|
@ -191,12 +167,14 @@ object(Dom\DocumentType)#4 (23) {
|
|||
string(0) ""
|
||||
["internalSubset"]=>
|
||||
NULL
|
||||
["nodeName"]=>
|
||||
string(5) "qname"
|
||||
["nodeValue"]=>
|
||||
NULL
|
||||
["nodeType"]=>
|
||||
int(10)
|
||||
["nodeName"]=>
|
||||
string(5) "qname"
|
||||
["baseURI"]=>
|
||||
NULL
|
||||
["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) ""
|
||||
|
|
|
@ -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) "<!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"]=>
|
||||
|
@ -61,20 +65,8 @@ object(Dom\DocumentType)#2 (24) {
|
|||
NULL
|
||||
["nextSibling"]=>
|
||||
string(22) "(object value omitted)"
|
||||
["attributes"]=>
|
||||
["nodeValue"]=>
|
||||
NULL
|
||||
["isConnected"]=>
|
||||
bool(true)
|
||||
["ownerDocument"]=>
|
||||
string(22) "(object value omitted)"
|
||||
["namespaceURI"]=>
|
||||
NULL
|
||||
["prefix"]=>
|
||||
string(0) ""
|
||||
["localName"]=>
|
||||
NULL
|
||||
["baseURI"]=>
|
||||
string(%d) "%s"
|
||||
["textContent"]=>
|
||||
NULL
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue