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

ApplicationLatte\Template can't be rendered on PHP >= 8.2 #384

Open
forrest79 opened this issue Nov 20, 2024 · 0 comments
Open

ApplicationLatte\Template can't be rendered on PHP >= 8.2 #384

forrest79 opened this issue Nov 20, 2024 · 0 comments

Comments

@forrest79
Copy link

forrest79 commented Nov 20, 2024

Version: 3.0

Bug Description

PHP 8.2 and greater disables creating dynamic properties on a class. If you want to use ApplicationLatte\Template instead of ApplicationLatte\DefaultTemplate - calling render() or renderToString() method with some parameter will fail, because dynamic property is creating and only DefaultTemplate has AllowDynamicProperties attribute, that allows this.

Steps To Reproduce

$template = new Nette\Bridges\ApplicationLatte\Template(new Latte\Engine());
$template->render('test.latte', ['name' => 'test']);
// Deprecated: Creation of dynamic property [Nette\Bridges\ApplicationLatte\Template]::$name is deprecated

Expected Behavior

Template is correctly rendered.

Possible Solution

Add #[\AllowDynamicProperties] also to ApplicationLatte\Template class? Don't use dynamic properties and use __get/__set/__isset/__unset instead of it?

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