mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
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.
21 lines
404 B
PHP
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
|