ID: 38354 Updated by: [EMAIL PROTECTED] Reported By: rowanjl at gmail dot com -Status: Verified +Status: Closed Bug Type: SimpleXML related Operating System: Linux PHP Version: 5.1.4 New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Fixed in HEAD and PHP_5_2 branch Previous Comments: ------------------------------------------------------------------------ [2006-08-06 11:39:50] rowanjl at gmail dot com The expected and actual results are reversed, I'd correct that if I could, sorry for the mix up. ------------------------------------------------------------------------ [2006-08-06 08:47:42] rowanjl at gmail dot com 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> -------------------- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38354&edit=1
