/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/dom/tests/modern/xml/Element_innerHTML_writing_errors.phpt
47 строк
1009 B
Niels Dossche
Implement Dom $innerHTML property
02 июл 2024, 21:15
02 июл 2024, 21:15
768900b
Код
Авторство
О чём код?
--TEST-- Test writing Element::$innerHTML on XML documents - error cases --EXTENSIONS-- dom --FILE-- <?php $dom = DOM\XMLDocument::createFromString(<<<XML <!DOCTYPE root [ <!ENTITY foo "content"> ]> <root/> XML); $child = $dom->documentElement->appendChild($dom->createElementNS('urn:a', 'child')); $original = $dom->saveXML(); function test($child, $html) { global $dom, $original; try { $child->innerHTML = $html; } catch (DOMException $e) { echo $e->getMessage(), "\n"; } var_dump($dom->saveXML() === $original); } test($child, '&foo;'); test($child, '</root>'); test($child, '</root><foo/><!--'); test($child, '--></root><!--'); test($child, '<'); test($child, '<!ENTITY foo "content">'); ?> --EXPECT-- XML fragment is not well-formed bool(true) XML fragment is not well-formed bool(true) XML fragment is not well-formed bool(true) XML fragment is not well-formed bool(true) XML fragment is not well-formed bool(true) XML fragment is not well-formed bool(true)