File tree Expand file tree Collapse file tree 2 files changed +3
-20
lines changed
Expand file tree Collapse file tree 2 files changed +3
-20
lines changed Original file line number Diff line number Diff line change @@ -1240,24 +1240,6 @@ class GeneralConfig extends BaseConfig
12401240 */
12411241 public bool $ enableTemplateCaching = true ;
12421242
1243- /**
1244- * @var bool Whether all Twig templates should be sandboxed.
1245- *
1246- * ::: code
1247- * ```php Static Config
1248- * ->enableTwigSandbox(false)
1249- * ```
1250- * ```shell Environment Override
1251- * CRAFT_ENABLE_TWIG_SANDBOX=false
1252- * ```
1253- * :::
1254- *
1255- * @see enableTwigSandbox()
1256- *
1257- * @group Security
1258- */
1259- public bool $ enableTwigSandbox = false ;
1260-
12611243 /**
12621244 * @var string The prefix that should be prepended to HTTP error status codes when determining the path to look for an error’s template.
12631245 *
@@ -4747,9 +4729,10 @@ public function enableTemplateCaching(bool $value = true): self
47474729 *
47484730 * @see $enableTwigSandbox
47494731 */
4732+ #[Deprecated(message: 'in 6.0.0. Sandbox is always enabled. ' )]
47504733 public function enableTwigSandbox (bool $ value = true ): self
47514734 {
4752- $ this -> enableTwigSandbox = $ value ;
4735+ app ()-> booting ( fn () => Deprecator:: log ( ' generalConfig.enableTwigSandbox ' , ' Calling enableTwigSandbox() is deprecated. Sandbox is always enabled. ' )) ;
47534736
47544737 return $ this ;
47554738 }
Original file line number Diff line number Diff line change @@ -432,7 +432,7 @@ public function createTwig(): Environment
432432 $ twig ->getRuntime (EscaperRuntime::class)->addSafeClass ($ safeClass , ['html ' ]);
433433
434434 // Even an empty security policy will prevent non-closures from being allowed as arrow functions
435- $ twig ->addExtension (new SandboxExtension (new SecurityPolicy (), Cms:: config ()-> enableTwigSandbox ));
435+ $ twig ->addExtension (new SandboxExtension (new SecurityPolicy (), true ));
436436
437437 $ twig ->addExtension (new StringLoaderExtension ());
438438 $ twig ->addExtension (new Extension ($ this , $ twig ));
You can’t perform that action at this time.
0 commit comments