From dc220b7a8e5f2237effe2f496a35d68a248030fc Mon Sep 17 00:00:00 2001 From: sro0 <35873310+sro0@users.noreply.github.com> Date: Sat, 13 Jan 2024 11:57:06 +0100 Subject: [PATCH] Ensure XPath for ConfigDaemon matches exactly one element --- lib/Froxlor/Config/ConfigDaemon.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Froxlor/Config/ConfigDaemon.php b/lib/Froxlor/Config/ConfigDaemon.php index 78ca96bdf..f90dc8f9e 100644 --- a/lib/Froxlor/Config/ConfigDaemon.php +++ b/lib/Froxlor/Config/ConfigDaemon.php @@ -91,6 +91,9 @@ public function __construct($xml, $xpath) $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']);