Subject: | Unparsing empty structs |
When passing XML::RPC an empty struct, it parses correctly to an empty
<struct />:
$xmlrpc->call('method', ({}));
...
<?xml version="1.0" encoding="UTF-8" ?>
<methodCall>
<methodName>method</methodName>
<params>
<param>
<value>
<struct></struct>
</value>
</param>
</params>
</methodCall>
The unparsing however, doesn't construct an empty hash. Instead, it
generates an empty string:
$VAR1 = [
''
];
instead of
$VAR1 = [
{}
];
When adding data to the hash, all works well:
$xmlrpc->call('method', ({1=>2}));
...
<?xml version="1.0" encoding="UTF-8" ?>
<methodCall>
<methodName>method</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>1</name>
<value>
<i4>2</i4>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
...
$VAR1 = [
{
'1' => '2'
}
];