|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-06 11:39 UTC] rowanjl at gmail dot com
[2006-08-06 19:40 UTC] chregu@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 03:00:01 2025 UTC |
Description: ------------ When using AsXML on an element which contains children, the returned source is different from the original XML source. This prevents any direct comparison between the two. Reproduce code: --------------- <?php Header("Content-type: text/plain"); $XML = SimpleXML_Load_String('<code> <a href="javascript:alert(\'1\');"><strong>Item Two</strong></a> </code>'); foreach ($XML->XPath("//*") as $Element) { echo Trim($Element->AsXML()), "\n--------------------\n"; } ?> Expected result: ---------------- <?xml version="1.0"?> <code> <a href="javascript:alert('1');"><strong>Item Two</strong></a> </code> -------------------- <a href="javascript:alert('1');"> <strong>Item Two</strong> </a> -------------------- <strong>Item Two</strong> -------------------- Actual result: -------------- <?xml version="1.0"?> <code> <a href="javascript:alert('1');"><strong>Item Two</strong></a> </code> -------------------- <a href="javascript:alert('1');"><strong>Item Two</strong></a> -------------------- <strong>Item Two</strong> --------------------