From c2ab8b1683a5da7f6adaeb75f6fe6aa9cabbdf90 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Sun, 2 Dec 2018 17:47:50 +0100 Subject: [PATCH] 1 too many We were echoing the result of require(), resulting in a '1' being printed during login --- lib/SimpleSAML/XHTML/Template.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index d6fbf79e7..59a5df8dc 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -476,16 +476,11 @@ class Template extends Response */ protected function getContents() { - if ($this->twig !== false) { - $this->twigDefaultContext(); - if ($this->controller) { - $this->controller->display($this->data); - } - $content = $this->twig->render($this->twig_template, $this->data); - } else { - $content = require($this->findTemplatePath($this->template)); + $this->twigDefaultContext(); + if ($this->controller) { + $this->controller->display($this->data); } - return $content; + return = $this->twig->render($this->twig_template, $this->data); } @@ -508,11 +503,15 @@ class Template extends Response * This method is a remnant of the old templating system, where templates where shown manually instead of * returning a response. * - * @deprecated Do not use this method, use send() instead. + * @deprecated Do not use this method, use Twig + send() instead. Will be removed in 2.0 */ public function show() { - echo $this->getContents(); + if ($this->twig !== false) { + echo $this->getContents(); + } else { + require($this->findTemplatePath($this->template)); + } } -- GitLab