#21949 [NEW]: xmlrpc_encode_request does not maintain keys of non-zero-indexed arrays
| From: | chris dot norsoft at zetnet dot co dot uk | Date: | Wed, 29 Jan 2003 19:10:04 +0000 |
| Subject: | #21949 [NEW]: xmlrpc_encode_request does not maintain keys of non-zero-indexed arrays | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-31610@lists.php.net to get a copy of this message | ||
From: chris.norsoft@zetnet.co.uk
Operating system: Red Hat Linux 8.0
PHP version: 4.2.3
PHP Bug Type: XMLRPC-EPI related
Bug description: xmlrpc_encode_request does not maintain keys of non-zero-indexed arrays
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.
--
Edit bug report at http://bugs.php.net/?id=21949&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21949&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21949&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21949&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21949&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21949&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21949&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21949&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21949&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21949&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21949&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21949&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21949&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21949&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21949&r=gnused