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

Twig errors in entry uri format are ignored #4210

Open
spharion88 opened this issue May 2, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@spharion88
Copy link

commented May 2, 2019

Description

Adding invalid twig code to the entry URI leads to never changing URLs (without any error message).

Steps to reproduce

  1. add a valid entry uri format to an entry (for example: "locations/{slug}")
  2. view the entry uri in frontend
  3. change the entry uri format to something invalid (for example: "locations/{{ someUndefinedObject }}/{slug}")
  4. view the entry uri in frontend (it will be same as in step 2)

I would expect an exception (or any other error hint) in this case.

Additional info

  • Craft version: 3.1.25
  • PHP version: 7.1.22
  • Database driver & version: 5.7.23 - MySQL Community Server (MAMP 5.2.2)

@spharion88 spharion88 changed the title Twig errors in entry uri format is ignored Twig errors in entry uri format are ignored May 2, 2019

@brandonkelly

This comment has been minimized.

Copy link
Member

commented May 7, 2019

This is expected because we disable strict variables in Twig when rendering URI Format templates. I’ll mark as an enhancement request though, and we can consider making it possible to disable that behavior.

@spharion88

This comment has been minimized.

Copy link
Author

commented May 8, 2019

A configuration option would be great to enable it on dev environments. At the moment it is really hard to detect twig errors in uri formats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.