mirror of
https://github.com/php/php-src.git
synced 2025-01-25 13:14:22 +08:00
add test
This commit is contained in:
parent
92b3f6b90c
commit
2517da1a29
30
ext/simplexml/tests/bug38354.phpt
Normal file
30
ext/simplexml/tests/bug38354.phpt
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user