Skip to content
Snippets Groups Projects
Commit f7104c8b authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Throw an exception when configured theme controller is invalid

parent 5d16bc93
No related branches found
No related tags found
No related merge requests found
...@@ -165,13 +165,19 @@ class Template extends Response ...@@ -165,13 +165,19 @@ class Template extends Response
// check if we need to attach a theme controller // check if we need to attach a theme controller
$controller = $this->configuration->getOptionalString('theme.controller', null); $controller = $this->configuration->getOptionalString('theme.controller', null);
if ( if ($controller !== null) {
$controller !== null if (
&& class_exists($controller) class_exists($controller)
&& in_array(TemplateControllerInterface::class, class_implements($controller)) && in_array(TemplateControllerInterface::class, class_implements($controller))
) { ) {
/** @var \SimpleSAML\XHTML\TemplateControllerInterface $this->controller */ /** @var \SimpleSAML\XHTML\TemplateControllerInterface $this->controller */
$this->controller = new $controller(); $this->controller = new $controller();
} else {
throw new Error\ConfigurationError(
'Invalid controller was configured in `theme.controller`. ' .
' Make sure the class exists and implements the TemplateControllerInterface.'
);
}
} }
$this->fileSystem = new Filesystem(); $this->fileSystem = new Filesystem();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment