1--TEST-- 2Bug #38354 (Unwanted reformatting of XML when using AsXML) 3--EXTENSIONS-- 4simplexml 5--FILE-- 6<?php 7 8$xml = simplexml_load_string( 9'<code> 10 <a href="javascript:alert(\'1\');"><strong>Item Two</strong></a> 11</code>' 12); 13 14foreach ($xml->xpath("//*") as $element) { 15 var_dump($element->asXML()); 16} 17 18echo "Done\n"; 19?> 20--EXPECT-- 21string(104) "<?xml version="1.0"?> 22<code> 23 <a href="javascript:alert('1');"><strong>Item Two</strong></a> 24</code> 25" 26string(62) "<a href="javascript:alert('1');"><strong>Item Two</strong></a>" 27string(25) "<strong>Item Two</strong>" 28Done 29