From 3aba8c5aa30c73f8a5a16296915fc2fdc679fed8 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Thu, 29 Jan 2026 10:50:58 +0100 Subject: [PATCH] Error return --- sources/PropertyType/Compiler/PropertyTypeCompiler.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sources/PropertyType/Compiler/PropertyTypeCompiler.php b/sources/PropertyType/Compiler/PropertyTypeCompiler.php index e0edcc6b7..e78d7e88d 100644 --- a/sources/PropertyType/Compiler/PropertyTypeCompiler.php +++ b/sources/PropertyType/Compiler/PropertyTypeCompiler.php @@ -34,6 +34,9 @@ class PropertyTypeCompiler */ public function CompilePropertyTypeFromXML(string $sXMLContent): PropertyType { + if (!utils::StartsWith($sXMLContent, '')) { + throw new PropertyTypeCompilerException('Property types definition should be XML file'); + } $oDoc = new DesignDocument(); libxml_clear_errors(); $oDoc->loadXML($sXMLContent); @@ -45,6 +48,10 @@ class PropertyTypeCompiler /** @var \Combodo\iTop\DesignElement $oRoot */ $oRoot = $oDoc->firstChild; + if (!$oRoot) { + throw new PropertyTypeCompilerException('Property types definition not correctly formatted!'); + } + return PropertyTypeFactory::GetInstance()->CreatePropertyTypeFromDom($oRoot); }