From 7c553257a60da225edc138c9bee77ee85285fc96 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 16 Aug 2021 07:12:06 +0200 Subject: [PATCH] ObjectController: fail when loading twice --- library/Director/Web/Controller/ObjectController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/Director/Web/Controller/ObjectController.php b/library/Director/Web/Controller/ObjectController.php index cfb34f6f..202a0ea6 100644 --- a/library/Director/Web/Controller/ObjectController.php +++ b/library/Director/Web/Controller/ObjectController.php @@ -6,6 +6,7 @@ use gipfl\Web\Widget\Hint; use Icinga\Exception\IcingaException; use Icinga\Exception\InvalidPropertyException; use Icinga\Exception\NotFoundError; +use Icinga\Exception\ProgrammingError; use Icinga\Module\Director\Deployment\DeploymentInfo; use Icinga\Module\Director\DirectorObject\Automation\ExportInterface; use Icinga\Module\Director\Exception\NestingError; @@ -452,6 +453,9 @@ abstract class ObjectController extends ActionController protected function loadObject() { + if ($this->object) { + throw new ProgrammingError('Loading an object twice is not very efficient'); + } if ($this->object === null) { if ($id = $this->params->get('id')) { $this->object = IcingaObject::loadByType(