Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Error using filter _replace_ with Sandbox + StrictParsing #347

Closed
NoNoNo opened this issue Oct 25, 2023 · 0 comments
Closed

Fatal Error using filter _replace_ with Sandbox + StrictParsing #347

NoNoNo opened this issue Oct 25, 2023 · 0 comments

Comments

@NoNoNo
Copy link

NoNoNo commented Oct 25, 2023

Version: Latte 3.0.10 (latest), PHP 8.1.24

Bug Description

Using filter replace in Sandbox & StrictParsing mode:

Fatal error: Uncaught Latte\CompileException: Forbidden variable $this. in vendor/latte/latte/src/Latte/Essential/Passes.php on line 113

Steps To Reproduce

<?php

require_once 'vendor/autoload.php';

$latte = new \Latte\Engine;
$latte->setPolicy(\Latte\Sandbox\SecurityPolicy::createSafePolicy());
$latte->setSandboxMode();
$latte->setStrictParsing();
$latte->setLoader(new \Latte\Loaders\StringLoader);
$latte->render('{$test|replace("foo", "case")}', ['test' => 'test-foo']);

Expected Behavior

Output of string test-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant