ID: 38445
Updated by: [EMAIL PROTECTED]
Reported By: schow at macnexus dot org
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: All
PHP Version: Irrelevant
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2006-08-14 00:54:41] schow at macnexus dot org
Description:
------------
In the manual, the return type for xmlrpc_decode and
xmlrpc_decode_request should really be "mixed" and not "array."
If the service return is an array, struct, or multiple values, then
yes, an array is returned.
However, if just one scalar value is returned (see code example)
xmlrpc_decode will return just one string ("Hello!").
Reproduce code:
---------------
$xml1 = "<?xml version=\"1.0\"?>
<methodResponse>
<params><param><value><struct>
<member><name>One</name><value><string>2</string></value></member>
</struct></value></param></params>
</methodResponse>";
$xml2 = "<?xml version=\"1.0\"?>
<methodResponse>
<params><param><value>
<string>Hello!</string>
</value></param></params>
</methodResponse>";
$data1 = xmlrpc_decode($xml1);
$data2 = xmlrpc_decode($xml2);
echo gettype($data1);
echo gettype($data2);
Expected result:
----------------
PHP executes the code correctly. In the code, $data1 is the returned
value of xmlrpc_decode for an xmlrpc struct. gettype reports $data1 as
an array. $data2 is the returned value of an xml-rpc string scalar.
gettype reports it as a string.
Actual result:
--------------
The documentation should be changed to "mixed" to indicate that
xmlrpc_decode will not always return an array.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38445&edit=1