]> granicus.if.org Git - php/commitdiff
add test
authorAntony Dovgal <tony2001@php.net>
Sun, 6 Aug 2006 20:10:19 +0000 (20:10 +0000)
committerAntony Dovgal <tony2001@php.net>
Sun, 6 Aug 2006 20:10:19 +0000 (20:10 +0000)
ext/simplexml/tests/bug38354.phpt [new file with mode: 0644]

diff --git a/ext/simplexml/tests/bug38354.phpt b/ext/simplexml/tests/bug38354.phpt
new file mode 100644 (file)
index 0000000..8b3b2a2
--- /dev/null
@@ -0,0 +1,30 @@
+--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(66) "<a href="javascript:alert('1');">
+  <strong>Item Two</strong>
+</a>"
+string(25) "<strong>Item Two</strong>"
+Done