From c6f728cec6fedcbd583b5b3fa9d29d68708a3ef0 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 9 Feb 2021 01:21:53 +0900 Subject: [PATCH] Fix warnings in PHP 8.0 related to editor components --- classes/editor/EditorHandler.class.php | 2 +- .../image_link/image_link.class.php | 22 +++++++++---------- modules/editor/editor.controller.php | 2 +- modules/editor/editor.model.php | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/classes/editor/EditorHandler.class.php b/classes/editor/EditorHandler.class.php index 825c3a24c..88810cf0f 100644 --- a/classes/editor/EditorHandler.class.php +++ b/classes/editor/EditorHandler.class.php @@ -20,7 +20,7 @@ class EditorHandler extends BaseObject { Context::set('component_info', $info); - if(!$info->extra_vars) + if(!isset($info->extra_vars) || !$info->extra_vars) { return; } diff --git a/modules/editor/components/image_link/image_link.class.php b/modules/editor/components/image_link/image_link.class.php index bdd56c935..49700650d 100644 --- a/modules/editor/components/image_link/image_link.class.php +++ b/modules/editor/components/image_link/image_link.class.php @@ -43,17 +43,17 @@ class image_link extends EditorHandler */ function transHTML($xml_obj) { - $src = $xml_obj->attrs->src; - $width = $xml_obj->attrs->width; - $height = $xml_obj->attrs->height; - $align = $xml_obj->attrs->align; - $alt = $xml_obj->attrs->alt; - $title = $xml_obj->attrs->title; - $border = (int)$xml_obj->attrs->border; - $link_url = $xml_obj->attrs->link_url; - $open_window = $xml_obj->attrs->open_window; - $style = $xml_obj->attrs->style; - $margin = (int)$xml_obj->attrs->margin; + $src = $xml_obj->attrs->src ?? null; + $width = $xml_obj->attrs->width ?? null; + $height = $xml_obj->attrs->height ?? null; + $align = $xml_obj->attrs->align ?? null; + $alt = $xml_obj->attrs->alt ?? null; + $title = $xml_obj->attrs->title ?? null; + $border = intval($xml_obj->attrs->border ?? 0); + $link_url = $xml_obj->attrs->link_url ?? null; + $open_window = $xml_obj->attrs->open_window ?? null; + $style = $xml_obj->attrs->style ?? null; + $margin = intval($xml_obj->attrs->margin ?? 0); $src = str_replace(array('&','"'), array('&','&qout;'), $src); $src = str_replace('&', '&', $src); diff --git a/modules/editor/editor.controller.php b/modules/editor/editor.controller.php index dee64e148..a713566f2 100644 --- a/modules/editor/editor.controller.php +++ b/modules/editor/editor.controller.php @@ -272,7 +272,7 @@ class editorController extends editor if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; $xml_obj->attrs->{$m[1][$i]} = $m[2][$i]; } - $xml_obj->body = $match[4]; + $xml_obj->body = $match[4] ?? null; if(!$xml_obj->attrs->editor_component) return $match[0]; diff --git a/modules/editor/editor.model.php b/modules/editor/editor.model.php index ec166007d..15eb1a131 100644 --- a/modules/editor/editor.model.php +++ b/modules/editor/editor.model.php @@ -518,7 +518,7 @@ class editorModel extends editor return new BaseObject(-1, 'msg_component_is_not_founded', $component); } - if(!self::$_loaded_component_list[$component][$editor_sequence]) + if(!isset(self::$_loaded_component_list[$component][$editor_sequence])) { // Create an object of the component and execute $class_path = sprintf('./modules/editor/components/%s/', $component);