Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Bug #38354 (Unwanted reformatting of XML when using AsXML) --EXTENSIONS-- simplex..

Decoded Output download

--TEST--
Bug #38354 (Unwanted reformatting of XML when using AsXML)
--EXTENSIONS--
simplexml
--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
";
?>
--EXPECT--
string(104) "<?xml version="1.0"?>
<code>
    <a href="javascript:alert('1');"><strong>Item Two</strong></a>
</code>
"
string(62) "<a href="javascript:alert('1');"><strong>Item Two</strong></a>"
string(25) "<strong>Item Two</strong>"
Done

Did this file decode correctly?

Original Code

--TEST--
Bug #38354 (Unwanted reformatting of XML when using AsXML)
--EXTENSIONS--
simplexml
--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";
?>
--EXPECT--
string(104) "<?xml version="1.0"?>
<code>
    <a href="javascript:alert('1');"><strong>Item Two</strong></a>
</code>
"
string(62) "<a href="javascript:alert('1');"><strong>Item Two</strong></a>"
string(25) "<strong>Item Two</strong>"
Done

Function Calls

None

Variables

None

Stats

MD5 8e66376d6340de8b0469447109d2a9da
Eval Count 0
Decode Time 87 ms