Skip to content

Commit

Permalink
MDL-52209 webservice_xmlrpc: Remove Zend from webservice_xmlrpc
Browse files Browse the repository at this point in the history
Additional fixes.
  • Loading branch information
junpataleta authored and danpoltawski committed Dec 9, 2015
1 parent 8573e52 commit 638f751
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions webservice/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ information provided here is intended especially for developers.

This information is intended for authors of webservices, not people writing webservice clients.

=== 3.1 ===

* Zend_XmlRpc has been dropped from webservice_xmlrpc. Fault strings that were generated by
Zend_XmlRpc_XXX_Exception exceptions (i.e. 'Method "[methodname]" does not exist') are no longer used
which may display a different error message depending on the string returned by the getMessage()
method of the thrown exception.

=== 3.0 ===

* WS protocols webservice/myprotocol:use capabilities were defined with a high riskbitmask value
Expand Down
2 changes: 1 addition & 1 deletion webservice/xmlrpc/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function call($functionname, $params = array()) {
// Decode the response.
$result = xmlrpc_decode($response);
if (is_array($result) && xmlrpc_is_fault($result)) {
throw new moodle_exception($result['faultString']);
throw new Exception($result['faultString'], $result['faultCode']);
}

return $result;
Expand Down
6 changes: 4 additions & 2 deletions webservice/xmlrpc/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ protected function prepare_response() {
if (!empty($this->function->returns_desc)) {
$validatedvalues = external_api::clean_returnvalue($this->function->returns_desc, $this->returns);
$encodingoptions = array(
"encoding" => "utf-8"
"encoding" => "utf-8",
"verbosity" => "no_white_space"
);
// We can now convert the response to the requested XML-RPC format.
$this->response = xmlrpc_encode_request(null, $validatedvalues, $encodingoptions);
Expand Down Expand Up @@ -186,7 +187,8 @@ protected function generate_error(Exception $ex, $faultcode = 404) {
);

$encodingoptions = array(
"encoding" => "utf-8"
"encoding" => "utf-8",
"verbosity" => "no_white_space"
);

return xmlrpc_encode_request(null, $fault, $encodingoptions);
Expand Down

0 comments on commit 638f751

Please sign in to comment.