|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21949 xmlrpc_encode_request does not maintain keys of non-zero-indexed arrays
Submitted: 2003-01-29 13:10 UTC Modified: 2003-01-30 09:35 UTC
From: chris dot norsoft at zetnet dot co dot uk Assigned:
Status: Not a bug Package: XMLRPC-EPI related
PHP Version: 4.2.3 OS: Red Hat Linux 8.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: chris dot norsoft at zetnet dot co dot uk
New email:
PHP Version: OS:


 [2003-01-29 13:10 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>
- <params>
- <param>
- <value>
- <param>
- <value>

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.




Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-30 09:35 UTC]
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.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Sep 25 20:05:52 2022 UTC