PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #21949 xmlrpc_encode_request does not maintain keys of non-zero-indexed arrays
Submitted:29 Jan 2003 1:10pm UTC Modified: 30 Jan 2003 9:35am UTC
From:chris dot norsoft at zetnet dot co dot uk Assigned to:
Status:Bogus Category:XMLRPC-EPI related
Version:4.2.3 OS:Red Hat Linux 8.0
View/Vote Developer Edit Submission

[29 Jan 2003 1:10pm UTC] chris dot norsoft at zetnet dot co dot uk
When I run a sequence such as:

$test = array(1234 => 5, 5678 => 2);
$rpc = xmlrpc_encode_request("method", $test);
print $rpc;

the XMLRPC extension does not observe the non-zero-indexed nature of the
array and produces a request such as:

  <?xml version="1.0" encoding="iso-8859-1" ?> 
- <methodCall>
  <methodName>method</methodName> 
- <params>
- <param>
- <value>
  <int>5</int> 
  </value>
  </param>
- <param>
- <value>
  <int>2</int> 
  </value>
  </param>
  </params>
  </methodCall>

At the other end, this decodes to:

array(0 => 5, 1 => 2)

which is not the same as the original data passed. The same occurs when
using string types using numeric values as the array keys, eg.

array("1234" => 5, "5678" => 2)

or by using settype(... "string") on the array keys.

I believe that the XMLRPC extension should generate a <struct> for
arrays such as this, so that the number key to value mapping can be
preserved.

Regards,

Chris.
[30 Jan 2003 9:35am UTC] sterling@php.net
Not a bug, XML-RPC is ambigous as to the value that the <name> field can
contain.  However, all indications point to it being a string value, in
XML this represents a value that is non-numeric.

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC