From:             tony at marston-home dot demon dot co dot uk
Operating system: Windows XP
PHP version:      5.3.1
PHP Bug Type:     *General Issues
Bug description:  xmlrpc_server_call_method does not preserve keys in indexed 
arrays

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 bug report at http://bugs.php.net/?id=50285&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=50285&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=50285&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=50285&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=50285&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50285&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=50285&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=50285&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=50285&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=50285&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=50285&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=50285&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=50285&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=50285&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=50285&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50285&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50285&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=50285&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=50285&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=50285&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=50285&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=50285&r=mysqlcfg

Reply via email to