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 #72971 (2): SimpleXML property write does not respect namespace --EXTENSIONS-..
Decoded Output download
--TEST--
Bug #72971 (2): SimpleXML property write does not respect namespace
--EXTENSIONS--
simplexml
--FILE--
<?php
$xml = new SimpleXMLElement('<root xmlns:ns="ns"><foo>bar</foo><ns:foo>ns:bar</ns:foo></root>');
$xml->foo = 'new-bar';
var_dump($xml->foo);
var_dump($xml->children('ns')->foo);
$xml->children('ns')->foo = 'ns:new-bar';
var_dump($xml->foo);
var_dump($xml->children('ns')->foo);
?>
--EXPECT--
object(SimpleXMLElement)#2 (1) {
[0]=>
string(7) "new-bar"
}
object(SimpleXMLElement)#3 (1) {
[0]=>
string(6) "ns:bar"
}
object(SimpleXMLElement)#3 (1) {
[0]=>
string(7) "new-bar"
}
object(SimpleXMLElement)#2 (1) {
[0]=>
string(10) "ns:new-bar"
}
Did this file decode correctly?
Original Code
--TEST--
Bug #72971 (2): SimpleXML property write does not respect namespace
--EXTENSIONS--
simplexml
--FILE--
<?php
$xml = new SimpleXMLElement('<root xmlns:ns="ns"><foo>bar</foo><ns:foo>ns:bar</ns:foo></root>');
$xml->foo = 'new-bar';
var_dump($xml->foo);
var_dump($xml->children('ns')->foo);
$xml->children('ns')->foo = 'ns:new-bar';
var_dump($xml->foo);
var_dump($xml->children('ns')->foo);
?>
--EXPECT--
object(SimpleXMLElement)#2 (1) {
[0]=>
string(7) "new-bar"
}
object(SimpleXMLElement)#3 (1) {
[0]=>
string(6) "ns:bar"
}
object(SimpleXMLElement)#3 (1) {
[0]=>
string(7) "new-bar"
}
object(SimpleXMLElement)#2 (1) {
[0]=>
string(10) "ns:new-bar"
}
Function Calls
None |
Stats
MD5 | e918327a7b5d993a97b86c16727be703 |
Eval Count | 0 |
Decode Time | 91 ms |