1
0
mirror of https://github.com/php/php-src.git synced 2026-04-02 13:43:02 +02:00
Files
archived-php-src/ext/simplexml/tests/bug38354.phpt
2020-02-03 22:52:20 +01:00

29 lines
621 B
PHP

--TEST--
Bug #38354 (Unwanted reformatting of XML when using AsXML)
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
$xml = simplexml_load_string(
'<code>
<a href="javascript:alert(\'1\');"><strong>Item Two</strong></a>
</code>'
);
foreach ($xml->xpath("//*") as $element) {
var_dump($element->asXML());
}
echo "Done\n";
?>
--EXPECT--
string(104) "<?xml version="1.0"?>
<code>
<a href="javascript:alert('1');"><strong>Item Two</strong></a>
</code>
"
string(62) "<a href="javascript:alert('1');"><strong>Item Two</strong></a>"
string(25) "<strong>Item Two</strong>"
Done