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

Fix ternary conditions escaping bug #3123

Merged
merged 6 commits into from
Feb 10, 2021
Merged

Fix ternary conditions escaping bug #3123

merged 6 commits into from
Feb 10, 2021

Conversation

duncanmcclean
Copy link
Member

This pull request fixes #2675.

In that issue, code like this: {{ seo_title ? seo_title : title }} would return this Let\'s work together (notice the slash).

The slash is caused by var_export escaping the ' with a slash. This is then fixed after the string has been eval'd by PHP, I'm just using the stripslashes function to do so.

I've added a test to ensure the use case from the issue is fixed and to ensure it doesn't break links where slashes may be used.

@jasonvarga
Copy link
Member

Looks like you also fixed when you use it with the ?= syntax. I added a test for that. Otherwise, looks great, thanks.

@jasonvarga jasonvarga merged commit 4faffd3 into statamic:3.0 Feb 10, 2021
@duncanmcclean duncanmcclean deleted the fix/antlers-tenary-escaping branch February 10, 2021 18:06
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.

Weird antlers behaviour with simple output
2 participants