#38445 [Opn->Csd]: xmlrpc_decode/decode_request Return Type

From: Date: Mon, 22 Jan 2007 02:46:58 +0000
Subject: #38445 [Opn->Csd]: xmlrpc_decode/decode_request Return Type
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969374960@lists.php.net to get a copy of this message
ID: 38445 Updated by: didou@php.net 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

« previous php.doc (#969374960) next »