php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48670 xmlrpc_decode() decodes Hashtable response with integer key incorrectly
Submitted: 2009-06-24 02:12 UTC Modified: 2009-11-24 20:34 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: zhangsilly at gmail dot com Assigned:
Status: Not a bug Package: XMLRPC-EPI related
PHP Version: 5.2.10 OS: Windows XP
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zhangsilly at gmail dot com
New email:
PHP Version: OS:

 

 [2009-06-24 02:12 UTC] zhangsilly at gmail dot com
Description:
------------
xmlrpc_decode decode hashtable response with integer key will ignore the key, just decode the same result as Vector.

Reproduce code:
---------------
ws-apache encode the Hashtable<Integer, String> as xmlrpc_decode's parameter:
<?php
print_r(xmlrpc_decode('<?xml version="1.0" encoding="UTF-8"?><methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions"><params><param><value><struct><member><name><value><i4>3</i4></value></name><value>wps2000</value></member><member><name><value><i4>0</i4></value></name><value>ddr</value></member></struct></value></param></params></methodResponse>'));

I format the xml response here:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">
	<params>
		<param>
			<value>
				<struct>
					<member>
						<name>
							<value>
								<i4>3</i4>
							</value>
						</name>
						<value>wps2000</value>
					</member>
					<member>
						<name>
							<value>
								<i4>0</i4>
							</value>
						</name>
						<value>ddr</value>
					</member>
				</struct>
			</value>
		</param>
	</params>
</methodResponse>

It seems the xmlrpc_decode just take Hashtable<Integer, Object> as Vector<Object>

Expected result:
----------------
array(
    3  => wps2000
    0  => ddr
)

Actual result:
--------------
Array
(
    [0] => wps2000
    [1] => ddr
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-24 20:34 UTC] jani@php.net
More recent, same issue: bug #50285

Closing this in favor of the newer report. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 00:01:27 2024 UTC