Ensure XPath for ConfigDaemon matches exactly one element (#1224)

This commit is contained in:
sro0
2024-01-13 12:31:15 +01:00
committed by GitHub
parent 8740947323
commit 854c930696
2 changed files with 4 additions and 1 deletions

View File

@@ -91,6 +91,9 @@ class ConfigDaemon
$this->fullxml = $xml;
$this->xpath = $xpath;
$this->daemon = $this->fullxml->xpath($this->xpath);
if (count($this->daemon) !== 1) {
throw new Exception('XPath "' . $this->xpath . '" didn\'t return exactly one element');
}
$attributes = $this->daemon[0]->attributes();
if ($attributes['title'] != '') {
$this->title = $this->parseContent((string)$attributes['title']);