MDL-70823 blocks: safer unserializing during block restore.
This commit is contained in:
@@ -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 = '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user