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