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

Merge branch 'PHP-8.0'

* PHP-8.0:
  NEWS
  Fix bug #81325  Segfault in zif_simplexml_import_dom
This commit is contained in:
Remi Collet
2021-08-03 12:08:03 +02:00
2 changed files with 20 additions and 1 deletions

View File

@@ -2619,7 +2619,7 @@ PHP_FUNCTION(simplexml_import_dom)
nodep = xmlDocGetRootElement((xmlDocPtr) nodep);
}
if (nodep->type == XML_ELEMENT_NODE) {
if (nodep && nodep->type == XML_ELEMENT_NODE) {
if (!ce) {
ce = sxe_class_entry;
fptr_count = NULL;

View File

@@ -0,0 +1,19 @@
--TEST--
BUg #81325 (segfault in zif_simplexml_import_dom)
--SKIPIF--
<?php
if (!extension_loaded('simplexml')) die('skip simplexml not available');
if (!extension_loaded('dom')) die('skip simplexml not available');
?>
--FILE--
<?php
$dom = new DOMDocument;
$dom->loadXML("foo");
$xml = simplexml_import_dom($dom);
?>
Done
--EXPECTF--
Warning: DOMDocument::loadXML(): Start tag expected%s
Warning: simplexml_import_dom(): Invalid Nodetype%s
Done