Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-29712server was translating too many HTML characters. use htmlspe…

…cialchars instead of htmlentities. Translated characters by htmlspecialchars are compatible with XML validation, and so XML parsers for javascript, java...
  • Loading branch information...
commit dd154420ee5bd3e2421e6c53613ffec1ec976d95 1 parent 28ab88e
Jérôme Mouneyrac mouneyrac authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 webservice/rest/locallib.php
6 webservice/rest/locallib.php
View
@@ -95,9 +95,9 @@ protected function send_error($ex=null) {
$this->send_headers();
$xml = '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
$xml .= '<EXCEPTION class="'.get_class($ex).'">'."\n";
- $xml .= '<MESSAGE>'.htmlentities($ex->getMessage(), ENT_COMPAT, 'UTF-8').'</MESSAGE>'."\n";
+ $xml .= '<MESSAGE>'.htmlspecialchars($ex->getMessage(), ENT_COMPAT, 'UTF-8').'</MESSAGE>'."\n";
if (debugging() and isset($ex->debuginfo)) {
- $xml .= '<DEBUGINFO>'.htmlentities($ex->debuginfo, ENT_COMPAT, 'UTF-8').'</DEBUGINFO>'."\n";
+ $xml .= '<DEBUGINFO>'.htmlspecialchars($ex->debuginfo, ENT_COMPAT, 'UTF-8').'</DEBUGINFO>'."\n";
}
$xml .= '</EXCEPTION>'."\n";
echo $xml;
@@ -134,7 +134,7 @@ protected static function xmlize_result($returns, $desc) {
if (is_null($returns)) {
return '<VALUE null="null"/>'."\n";
} else {
- return '<VALUE>'.htmlentities($returns, ENT_COMPAT, 'UTF-8').'</VALUE>'."\n";
+ return '<VALUE>'.htmlspecialchars($returns, ENT_COMPAT, 'UTF-8').'</VALUE>'."\n";
}
} else if ($desc instanceof external_multiple_structure) {
Please sign in to comment.
Something went wrong with that request. Please try again.