From f0df00a82daf4283ca5eed2fd73e11a9e45dea93 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 17 May 2021 20:06:46 +0900 Subject: [PATCH] Fix fatal error when widget code contains invalid XML --- modules/widget/widget.controller.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/widget/widget.controller.php b/modules/widget/widget.controller.php index 16e23d033..2e79c0ce8 100644 --- a/modules/widget/widget.controller.php +++ b/modules/widget/widget.controller.php @@ -273,8 +273,13 @@ class widgetController extends widget */ function transWidget($matches) { - $vars = new stdClass; $xml = simplexml_load_string(trim($matches[0])); + if ($xml === false) + { + return '
Invalid XML in widget code.
'; + } + + $vars = new stdClass; foreach ($xml->img ? $xml->img->attributes() : $xml->attributes() as $key => $val) { $vars->{$key} = strval($val);