mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
bd9f4fa676
For rationale, see https://github.com/php/php-src/pull/6787 Make extension checks lowercase, add a special case for opcache that has internal name not matching .so filename. Extensions migrated in part 2: * dom * exif * fileinfo * ffi
35 lines
872 B
PHP
35 lines
872 B
PHP
--TEST--
|
|
Bug #36756 (DOMDocument::removeChild corrupts node)
|
|
--EXTENSIONS--
|
|
dom
|
|
--FILE--
|
|
<?php
|
|
|
|
/* Node is preserved from removeChild */
|
|
$dom = new DOMDocument();
|
|
$dom->loadXML('<root><child/></root>');
|
|
$xpath = new DOMXpath($dom);
|
|
$node = $xpath->query('/root')->item(0);
|
|
echo $node->nodeName . "\n";
|
|
$dom->removeChild($GLOBALS['dom']->firstChild);
|
|
echo "nodeType: " . $node->nodeType . "\n";
|
|
/* Node gets destroyed during removeChild */
|
|
$dom->loadXML('<root><child/></root>');
|
|
$xpath = new DOMXpath($dom);
|
|
$node = $xpath->query('//child')->item(0);
|
|
echo $node->nodeName . "\n";
|
|
$GLOBALS['dom']->removeChild($GLOBALS['dom']->firstChild);
|
|
|
|
try {
|
|
echo "nodeType: " . $node->nodeType . "\n";
|
|
} catch (\Error $e) {
|
|
echo get_class($e) . ': ' . $e->getMessage() .\PHP_EOL;
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
root
|
|
nodeType: 1
|
|
child
|
|
Error: Couldn't fetch DOMElement. Node no longer exists
|