MDL-70823 blocks: safer unserializing during block restore.

This commit is contained in:
Paul Holden
2021-11-03 16:57:24 +01:00
committed by Sara Arjona
parent dd66a550cb
commit f18f500a11
14 changed files with 25 additions and 20 deletions
+2 -2
View File
@@ -51,7 +51,7 @@ class block_html_edit_form extends block_edit_form {
}
function set_data($defaults) {
if (!empty($this->block->config) && is_object($this->block->config)) {
if (!empty($this->block->config) && !empty($this->block->config->text)) {
$text = $this->block->config->text;
$draftid_editor = file_get_submitted_draft_itemid('config_text');
if (empty($text)) {
@@ -61,7 +61,7 @@ class block_html_edit_form extends block_edit_form {
}
$defaults->config_text['text'] = file_prepare_draft_area($draftid_editor, $this->block->context->id, 'block_html', 'content', 0, array('subdirs'=>true), $currenttext);
$defaults->config_text['itemid'] = $draftid_editor;
$defaults->config_text['format'] = $this->block->config->format;
$defaults->config_text['format'] = $this->block->config->format ?? FORMAT_MOODLE;
} else {
$text = '';
}