From e54aebebca5453a60d589757d034846fc7e40a9d Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 16 Feb 2021 21:52:02 +0200 Subject: [PATCH] xml tags must not include undeclared namespaces like: set_attrs($reader); - while($reader->read() && $reader->depth > $depth) + while(($ok=$reader->read()) && $reader->depth > $depth) { if ($reader->nodeType == XMLReader::ELEMENT && $reader->depth > $depth) { @@ -135,6 +135,12 @@ class Widget $this->attrs[(string)$reader->name] = (string)$reader->value; } } + // give a clear indication where the template error is + if (!$ok && ($error = libxml_get_last_error())) + { + $file = str_replace([EGW_SERVER_ROOT.'/', '//default/etemplates/'], '', $error->file); + throw new \Exception("Error passing XML file '$file' line $error->line: $error->message"); + } // Reset content as we leave if($old_cont) { @@ -156,6 +162,7 @@ class Widget } else { + libxml_use_internal_errors(true); $reader = new XMLReader(); if (!$reader->XML($xml)) { diff --git a/api/src/Etemplate/Widget/HistoryLog.php b/api/src/Etemplate/Widget/HistoryLog.php index ceb15b3dbb..473e1589c9 100644 --- a/api/src/Etemplate/Widget/HistoryLog.php +++ b/api/src/Etemplate/Widget/HistoryLog.php @@ -45,7 +45,8 @@ class HistoryLog extends Etemplate\Widget if(!is_array($type)) { list($basetype) = explode('-',$type); - $widget = @self::factory($basetype, '<'.$type.' type="'.$type.'"/>', $key); + list($tag) = explode(':', $type); // xml tags must not include undeclared namespaces like: <'.$tag.' type="'.$type.'"/>', $key); $widget->id = $key; $widget->attrs['type'] = $type; $widget->type = $type;