1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/dom/tests/modern/xml/Node_removeChild_from_comment.phpt
Niels Dossche c66221b7ba Fix arginfo violation in removeChild() (#14717)
It was possible to return false without throwing an exception.
This is even wrong in "old DOM" because we expect either a NOT_FOUND_ERR
or NO_MODIFICATION_ALLOWED_ERR according to the documentation.
A side effect of this patch is that it prioritises NOT_FOUND_ERR over
NO_MODIFICATION_ALLOWED_ERR but I think that's fine.
2024-06-29 16:32:36 +02:00

21 lines
404 B
PHP

--TEST--
Removing a child from a comment should result in NOT_FOUND_ERR
--EXTENSIONS--
dom
--FILE--
<?php
$dom = Dom\XMLDocument::createFromString('<root><!-- comment --><child/></root>');
$comment = $dom->documentElement->firstChild;
$child = $comment->nextSibling;
try {
$comment->removeChild($child);
} catch (DOMException $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Not Found Error