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 #44478 (Inconsistent behaviour when assigning new nodes) --EXTENSIONS-- simpl..

Decoded Output download

--TEST--
Bug #44478 (Inconsistent behaviour when assigning new nodes)
--EXTENSIONS--
simplexml
--FILE--
<?php
$xml_element = new simpleXMLElement('<root></root>');
$xml_element->node1 = 'a &#38; b';
print $xml_element->node1."
";
$xml_element->node1 = 'a &#38; b';
print $xml_element->node1."
";
$xml_element->addChild('node2','a &#38; b');
print $xml_element->node2."
";
$xml_element->node2 = 'a & b';
print $xml_element->node2."
";

print $xml_element->asXML();

?>
--EXPECT--
a &#38; b
a &#38; b
a & b
a & b
<?xml version="1.0"?>
<root><node1>a &amp;#38; b</node1><node2>a &amp; b</node2></root>
	

Did this file decode correctly?

Original Code

--TEST--
Bug #44478 (Inconsistent behaviour when assigning new nodes)
--EXTENSIONS--
simplexml
--FILE--
<?php
$xml_element = new simpleXMLElement('<root></root>');
$xml_element->node1 = 'a &#38; b';
print $xml_element->node1."\n";
$xml_element->node1 = 'a &#38; b';
print $xml_element->node1."\n";
$xml_element->addChild('node2','a &#38; b');
print $xml_element->node2."\n";
$xml_element->node2 = 'a & b';
print $xml_element->node2."\n";

print $xml_element->asXML();

?>
--EXPECT--
a &#38; b
a &#38; b
a & b
a & b
<?xml version="1.0"?>
<root><node1>a &amp;#38; b</node1><node2>a &amp; b</node2></root>
	

Function Calls

None

Variables

None

Stats

MD5 d689a4b752d0dc90f24a4ee68ec4b84a
Eval Count 0
Decode Time 95 ms