mirror of
https://github.com/php/php-src.git
synced 2025-01-25 13:14:22 +08:00
MFB: Fixed bug #38438 (DOMNodeList->item(0) segfault on empty NodeList)
This commit is contained in:
parent
2c2125ad56
commit
a41723d0f4
@ -134,7 +134,7 @@ PHP_FUNCTION(dom_nodelist_item)
|
|||||||
zval_copy_ctor(return_value);
|
zval_copy_ctor(return_value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (objmap->baseobj) {
|
||||||
nodep = dom_object_get_node(objmap->baseobj);
|
nodep = dom_object_get_node(objmap->baseobj);
|
||||||
if (nodep) {
|
if (nodep) {
|
||||||
if (objmap->nodetype == XML_ATTRIBUTE_NODE || objmap->nodetype == XML_ELEMENT_NODE) {
|
if (objmap->nodetype == XML_ATTRIBUTE_NODE || objmap->nodetype == XML_ELEMENT_NODE) {
|
||||||
|
13
ext/dom/tests/bug38438.phpt
Normal file
13
ext/dom/tests/bug38438.phpt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
--TEST--
|
||||||
|
Bug #38438 (DOMNodeList->item(0) segfault on empty NodeList)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php require_once('skipif.inc'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$list = new DOMNodeList();
|
||||||
|
var_dump($list->item(0));
|
||||||
|
echo "OK\n";
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
NULL
|
||||||
|
OK
|
Loading…
Reference in New Issue
Block a user