Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-29442 add missing utf-8 to entity html encoding and decoding

  • Loading branch information...
commit f48902e139256512e5d69d183cd47b2ca3c110cf 1 parent 325e266
@skodak skodak authored
View
2  backup/util/loggers/file_logger.class.php
@@ -75,7 +75,7 @@ protected function action($message, $level, $options = null) {
if (substr($this->fullpath, -5) !== '.html') {
$content = $prefix . str_repeat(' ', $depth) . $message . PHP_EOL;
} else {
- $content = $prefix . str_repeat('&nbsp;&nbsp;', $depth) . htmlentities($message, ENT_QUOTES) . '<br/>' . PHP_EOL;
+ $content = $prefix . str_repeat('&nbsp;&nbsp;', $depth) . htmlentities($message, ENT_QUOTES, 'UTF-8') . '<br/>' . PHP_EOL;
}
if (false === fwrite($this->fhandle, $content)) {
throw new base_logger_exception('error_writing_file', $this->fullpath);
View
2  backup/util/loggers/output_indented_logger.class.php
@@ -38,7 +38,7 @@ protected function action($message, $level, $options = null) {
if (defined('STDOUT')) {
echo $prefix . str_repeat(' ', $depth) . $message . PHP_EOL;
} else {
- echo $prefix . str_repeat('&nbsp;&nbsp;', $depth) . htmlentities($message, ENT_QUOTES) . '<br/>' . PHP_EOL;
+ echo $prefix . str_repeat('&nbsp;&nbsp;', $depth) . htmlentities($message, ENT_QUOTES, 'UTF-8') . '<br/>' . PHP_EOL;
}
flush();
return true;
View
2  backup/util/loggers/output_text_logger.class.php
@@ -37,7 +37,7 @@ protected function action($message, $level, $options = null) {
if (defined('STDOUT')) {
echo $prefix . $message . PHP_EOL;
} else {
- echo $prefix . htmlentities($message, ENT_QUOTES) . '<br/>' . PHP_EOL;
+ echo $prefix . htmlentities($message, ENT_QUOTES, 'UTF-8') . '<br/>' . PHP_EOL;
}
flush();
return true;
View
2  cache/classes/definition.php
@@ -750,7 +750,7 @@ public function generate_multi_key_parts() {
if (!empty($this->identifiers)) {
$identifiers = array();
foreach ($this->identifiers as $key => $value) {
- $identifiers[] = htmlentities($key).'='.htmlentities($value);
+ $identifiers[] = htmlentities($key, ENT_QUOTES, 'UTF-8').'='.htmlentities($value, ENT_QUOTES, 'UTF-8');
}
$this->keyprefixmulti['identifiers'] = join('&', $identifiers);
}
View
2  lib/datalib.php
@@ -1802,7 +1802,7 @@ function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user
$timenow = time();
$info = $info;
if (!empty($url)) { // could break doing html_entity_decode on an empty var.
- $url = html_entity_decode($url);
+ $url = html_entity_decode($url, ENT_QUOTES, 'UTF-8');
} else {
$url = '';
}
View
2  lib/dml/pdo_moodle_database.php
@@ -172,7 +172,7 @@ public function get_last_error() {
* Function to print/save/ignore debugging messages related to SQL queries.
*/
protected function debug_query($sql, $params = null) {
- echo '<hr /> (', $this->get_dbtype(), '): ', htmlentities($sql);
+ echo '<hr /> (', $this->get_dbtype(), '): ', htmlentities($sql, ENT_QUOTES, 'UTF-8');
if($params) {
echo ' (parameters ';
print_r($params);
View
2  lib/filelib.php
@@ -2286,7 +2286,7 @@ function send_file($path, $filename, $lifetime = 'default' , $filter=0, $pathiss
$options = new stdClass();
$options->newlines = false;
$options->noclean = true;
- $text = htmlentities($pathisstring ? $path : implode('', file($path)));
+ $text = htmlentities($pathisstring ? $path : implode('', file($path)), ENT_QUOTES, 'UTF-8');
$output = '<pre>'. format_text($text, FORMAT_MOODLE, $options, $COURSE->id) .'</pre>';
readstring_accel($output, $mimetype, false);
View
6 lib/navigationlib.php
@@ -3389,9 +3389,9 @@ protected function get_course_modules($course) {
continue;
}
if ($type->modclass == MOD_CLASS_RESOURCE) {
- $resources[html_entity_decode($type->type)] = $type->typestr;
+ $resources[html_entity_decode($type->type, ENT_QUOTES, 'UTF-8')] = $type->typestr;
} else {
- $activities[html_entity_decode($type->type)] = $type->typestr;
+ $activities[html_entity_decode($type->type, ENT_QUOTES, 'UTF-8')] = $type->typestr;
}
}
} else {
@@ -4275,7 +4275,7 @@ protected function convert_child($child, $depth=1) {
}
if ($child->forcetitle || $child->title !== $child->text) {
- $attributes['title'] = htmlentities($child->title);
+ $attributes['title'] = htmlentities($child->title, ENT_QUOTES, 'UTF-8');
}
if (array_key_exists($child->key.':'.$child->type, $this->expandable)) {
$attributes['expandable'] = $child->key;
View
2  mod/wiki/pagelib.php
@@ -656,7 +656,7 @@ function print_content() {
$parsedcontent = wiki_parse_content('nwiki', $comment->content, $options);
}
- $cell4->text = format_text(html_entity_decode($parsedcontent['parsed_text']), FORMAT_HTML);
+ $cell4->text = format_text(html_entity_decode($parsedcontent['parsed_text'], ENT_QUOTES, 'UTF-8'), FORMAT_HTML);
} else {
$cell4->text = format_text($comment->content, FORMAT_HTML);
}
View
4 mod/wiki/parser/utils.php
@@ -14,9 +14,9 @@
class parser_utils {
public static function h($tag, $text = null, $options = array(), $escape_text = false) {
- $tag = htmlentities($tag);
+ $tag = htmlentities($tag, ENT_COMPAT, 'UTF-8');
if(!empty($text) && $escape_text) {
- $text = htmlentities($text);
+ $text = htmlentities($text, ENT_COMPAT, 'UTF-8');
}
return html_writer::tag($tag, $text, $options);
}
Please sign in to comment.
Something went wrong with that request. Please try again.