From: schow at macnexus dot org
Operating system: All
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: xmlrpc_decode/decode_request Return Type
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 bug report at http://bugs.php.net/?id=38445&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38445&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38445&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38445&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38445&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38445&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38445&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38445&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38445&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38445&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38445&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38445&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38445&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38445&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38445&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38445&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38445&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38445&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38445&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38445&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38445&r=mysqlcfg