ID:               50285
 User updated by:  tony at marston-home dot demon dot co dot uk
 Reported By:      tony at marston-home dot demon dot co dot uk
 Status:           Open
-Bug Type:         *General Issues
+Bug Type:         XMLRPC-EPI related
 Operating System: Windows XP
 PHP Version:      5.3.1
 New Comment:

This is not 'general', it is XMLRPC related.


Previous Comments:
------------------------------------------------------------------------

[2009-11-24 14:55:34] tony at marston-home dot demon dot co dot uk

Description:
------------
When the method called in xmlrpc_server_call_method() returns an array
where the keys are numeric but non-sequential it does not include the
keys in the xml response, so when that response is decoded by the client
all the keys are resequenced from zero. This means that all the original
keys are lost.

Reproduce code:
---------------
function indexedArray ( $func, $params) {
    return array(1=>'One', 3=>'Three', 5=>'Five');
} // indexedArray
$server = xmlrpc_server_create();
$result = xmlrpc_server_register_method($server, 'indexedArray',
'indexedArray');
$HTTP_RAW_POST_DATA = <<<EOD
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>indexedArray</methodName>
<params />
</methodCall>
EOD;
$response = xmlrpc_server_call_method($server, $HTTP_RAW_POST_DATA,
null);
$array = xmlrpc_decode($response);

Expected result:
----------------
The contents of $array should read (1=>'One', 3=>'Three', 5=>'Five').
This is because the xml document does not contain any <name> elements
for each <member>.

Actual result:
--------------
The contents of $array is (0=>'One', 1=>'Three', 2=>'Five')


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50285&edit=1

Reply via email to