#38429 [NEW]: xmlrpc server returns invalid fault response on bad user code
| From: | giunta dot gaetano at sea-aeroportimilano dot it | Date: | Fri, 11 Aug 2006 13:31:19 +0000 |
| Subject: | #38429 [NEW]: xmlrpc server returns invalid fault response on bad user code | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-100699@lists.php.net to get a copy of this message | ||
From: giunta dot gaetano at sea-aeroportimilano dot it
Operating system: windows 2000
PHP version: 5.1.4
PHP Bug Type: XMLRPC-EPI related
Bug description: xmlrpc server returns invalid fault response on bad user code
Description:
------------
When registering a php user function to be exposed as xmlrpc method, the
resulting xml will be that of an xmlrpc fault response iff the return
value of the user function is an array containing a key 'faultCode'.
When the result value contains other array members beside faultCode and
faultString, or the values of those two members are not an int and a
string, the generated xml will not be conforming to the xmlrpc spec, which
states: "A <fault> struct may not contain members other than those
specified".
I know that this situation is the fault of the coder, but, imho, the lib
should do its reasonable best to always work within the spec...
Reproduce code:
---------------
$x = xmlrpc_server_create();
xmlrpc_server_register_method($x, 'pluto', 'pippo');
$out = xmlrpc_server_call_method($x, xmlrpc_encode_request('pluto',
array()), null);
echo htmlspecialchars($out);
function pippo($meth, $params, $extras)
{
return array('faultCode' => 1, 'faultString' => array(1, 2, 3, 4),
'hello
world');
}
Actual result:
--------------
<?xml version="1.0" encoding="iso-8859-1"?> <methodResponse>
<params>
<value> <struct> <member> <name>faultCode</name> <value>
<int>1</int>
</value> </member> <member> <name>faultString</name> <value>
<array>
<data> <value> <int>1</int> </value> <value>
<int>2</int> </value> <value>
<int>3</int> </value> <value> <int>4</int> </value>
</data> </array>
</value> </member> <member> <name/> <value> <string>hello
world</string>
</value> </member> </struct> </value> </params>
</methodResponse>
--
Edit bug report at http://bugs.php.net/?id=38429&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38429&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38429&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38429&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38429&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38429&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38429&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38429&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38429&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38429&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38429&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38429&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38429&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38429&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38429&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38429&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38429&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38429&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38429&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38429&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38429&r=mysqlcfg