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); }