php.net |  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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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>
  <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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-30 09:35 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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC