1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.2' into PHP-8.3

* PHP-8.2:
  Fix GH-16039: Segmentation fault (access null pointer) in ext/dom/parentnode/tree.c
This commit is contained in:
Niels Dossche
2024-09-25 19:33:29 +02:00
3 changed files with 40 additions and 0 deletions

4
NEWS
View File

@@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.3.13
- DOM:
. Fixed bug GH-16039 (Segmentation fault (access null pointer) in
ext/dom/parentnode/tree.c). (nielsdos)
- PHPDBG:
. Fixed bug GH-15901 (phpdbg: Assertion failure on i funcs). (cmb)

View File

@@ -265,6 +265,11 @@ static zend_result dom_sanity_check_node_list_for_insertion(php_libxml_ref_obj *
if (instanceof_function(ce, dom_node_class_entry)) {
xmlNodePtr node = dom_object_get_node(Z_DOMOBJ_P(nodes + i));
if (!node) {
php_dom_throw_error(INVALID_STATE_ERR, /* strict */ true);
return FAILURE;
}
if (node->doc != documentNode) {
php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(document));
return FAILURE;

View File

@@ -0,0 +1,31 @@
--TEST--
GH-16039 (Segmentation fault (access null pointer) in ext/dom/parentnode/tree.c)
--EXTENSIONS--
dom
--FILE--
<?php
$dom = new DOMDocument;
$element = $dom->appendChild($dom->createElement('root'));
try {
$element->prepend('x', new DOMEntity);
} catch (DOMException $e) {
echo $e->getMessage(), "\n";
}
echo $dom->saveXML();
$dom->strictErrorChecking = false; // Should not have influence
try {
$element->prepend('x', new DOMEntity);
} catch (DOMException $e) {
echo $e->getMessage(), "\n";
}
echo $dom->saveXML();
?>
--EXPECT--
Invalid State Error
<?xml version="1.0"?>
<root/>
Invalid State Error
<?xml version="1.0"?>
<root/>