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

Use strict variables in Twig #18685

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cedric-anne
Copy link
Member

Checklist before requesting a review

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • This change requires a documentation update.

Description

With the default Twig configuration, accessing an unexisting variable, object property or object method will just be evaluated to true, without triggering any error. IMHO, it is a mistake to not use the strict_variables=true option and we should have done it when we started to use Twig templates.

I propose to enable strict variables in GLPI 11.0, as it is a major version. Indeed, it will be considered as a breaking change by plugins developers. If we validate this change, we should add a note about this in our migration guide.

I guess we will have to fix many of our templates. For now, I just changed the option value to see how many errors our test suite will detect.

@cedric-anne cedric-anne self-assigned this Jan 8, 2025
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

Successfully merging this pull request may close these issues.

1 participant