|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-01-22 02:46 UTC] didou@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 16:00:01 2025 UTC |
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.