Open Tampa opened 2 years ago
Can you provide more steps to reproduce the bug?
I setup an xmlrpc server in the controller:
public function query()
{
$this->load->library('xmlrpc_raw');
$this->load->library('xmlrpcs_raw');
$config['functions']['datarequest'] = array('function' => 'mainapi.datarequest');
$this->xmlrpcs_raw->initialize($config);
$this->xmlrpcs_raw->serve();
}
public function datarequest($request)
{
$this->load->library('xmlrpc_raw');
$this->load->library('xmlrpcs_raw');
$param = $request->output_parameters();
$response = $this->api_model->datarequest_main($param);
$response = array($response);
$this->xmlrpc->display_response(); // Error is likely thrown on this
return $this->xmlrpc_raw->send_response($response);
}
The model returns:
$response_xml = xmlrpc_encode(array(
'success' => True,
'errorMessage' => "",
'data' => $data
));
return $response_xml;
Testing the resulting xmlrpc server request I found various issues leading me to copy and change the xmlrpc and xmlrpcs libraries, because not only did this error occur each time I tried to print or display the response, but the response was treated as one large string instead of already encoded xml pushing it through htmlspecialchars and adding xml encoding and methodresponse parameters to it not letting me directly influence the xml structure.
The error references a missing function, which actually exists, but in the other library xmlrpc, xmlrpcs does not have that function. Copying it over does resolve the error, but whether the resulting xml is of the intended format I cannot say. I mainly needed this to form up a response for a client sending custom xmlrpc requests that don't follow the model Codeigniter sets out to utilize. It's a bit misleading that the feature exists, but has lots of hardcoded behavior in it not allowing for fully custom, and arguably malformed, xml to be generated and sent.
You are forced to either edit the library or write straight php in order to implement fully custom structures, there seems to be no way to fully dictate the structure as that is hardcoded in the library to add encoding and methodresponse + params to the structure no matter what.
Unfortunately cannot share the entire code as it contains too much proprietary structure, but I hope that's enough information.
ERROR - 2022-05-06 15:37:03 --> Severity: error --> Exception: Call to a member function prepare_response() on null system/libraries/Xmlrpcs.php 181