Skip to content

Commit

Permalink
Ensure XPath for ConfigDaemon matches exactly one element
Browse files Browse the repository at this point in the history
  • Loading branch information
z-e-r-0-t committed Jan 13, 2024
1 parent e684de6 commit dc220b7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Froxlor/Config/ConfigDaemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down

0 comments on commit dc220b7

Please sign in to comment.