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:
@@ -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;
|
||||
|
||||
19
ext/simplexml/tests/bug81325.phpt
Normal file
19
ext/simplexml/tests/bug81325.phpt
Normal 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
|
||||
Reference in New Issue
Block a user