summaryrefslogtreecommitdiff
path: root/ext/simplexml/tests/bug38354.phpt
blob: c78ba94fe3139548cc1a86e1df60f9e4ab9f0e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--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";
?>
--EXPECTF--
string(101) "<?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