From 288a54f6b0194121efa49f0aa9d70eb3ff439370 Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Sun, 24 Jan 2021 23:52:45 +0100 Subject: [PATCH] Add unit test --- tests/UnitTests/SecurityTests/SecurityTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/UnitTests/SecurityTests/SecurityTest.php b/tests/UnitTests/SecurityTests/SecurityTest.php index 2a4d3e59d..4af37e167 100644 --- a/tests/UnitTests/SecurityTests/SecurityTest.php +++ b/tests/UnitTests/SecurityTests/SecurityTest.php @@ -382,6 +382,15 @@ public function testNotTrustedUri() $this->smarty->security_policy->trusted_uri = array(); $this->assertContains('Preface | Smarty', $this->smarty->fetch('string:{fetch file="https://www.smarty.net/docs/en/preface.tpl"}')); } + + /** + * In security mode, accessing $smarty.template_object should be illegal. + */ + public function testSmartyTemplateObject() { + $this->expectException(SmartyCompilerException::class); + $this->smarty->display('string:{$smarty.template_object}'); + } + } class mysecuritystaticclass