Req #38429 [Opn->Wfx]: xmlrpc server returns invalid fault response on bad user code

From: Date: Tue, 13 Apr 2021 13:53:32 +0000
Subject: Req #38429 [Opn->Wfx]: xmlrpc server returns invalid fault response on bad user code
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233393@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=38429&edit=1 ID: 38429 Updated by: cmb@php.net Reported by: giunta dot gaetano at sea-aeroportimilano dot it Summary: xmlrpc server returns invalid fault response on bad user code -Status: Open +Status: Wont fix Type: Feature/Change Request Package: XMLRPC-EPI related Operating System: windows 2000 PHP Version: 5.1.4 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: The xmlrpc extension is unbundled and moved to PECL as of PHP 7.4.0. I'm temporarily maintaining the extension, but I will not do any feature additions. Actually, everybody is likely better off to switch to something else. Thus, I'm closing this ticket. Previous Comments: ------------------------------------------------------------------------ [2006-08-11 13:31:19] giunta dot gaetano at sea-aeroportimilano dot it 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 this bug report at https://bugs.php.net/bug.php?id=38429&edit=1

« previous php.bugs (#233393) next »