From 8c4c6bf03cea9032c8c42b2ea5d5b9c58d9bc134 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 11 Aug 2016 17:26:55 +0200 Subject: [PATCH] Fix serialization --- Views/View.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Views/View.php b/Views/View.php index d2792a5d5..dc8eae665 100644 --- a/Views/View.php +++ b/Views/View.php @@ -324,7 +324,7 @@ class View implements \Serializable * @since 1.0.0 * @author Dennis Eichhorn */ - public function getText(string $translation, string $module = null, string $theme = null) + private function getText(string $translation, string $module = null, string $theme = null) { if (!isset($module)) { $match = '/Modules/'; @@ -407,13 +407,19 @@ class View implements \Serializable /** * Serialize view for rendering. * - * @return string + * @return string|array * * @since 1.0.0 * @author Dennis Eichhorn */ public function serialize() { + $path = realpath($oldPath = __DIR__ . '/../..' . $this->template . '.tpl.php'); + + if ($path === false || StringUtils::startsWith($path, ROOT_PATH) === false) { + return $this->toArray(); + } + return $this->render(); }