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

dev/core#4146 Remove (old) Smarty-forward incompatible syntax from Address.tpl #25669

Merged
merged 1 commit into from
Feb 28, 2023

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Feb 24, 2023

Overview

dev/core#4146 Remove (old) Smarty-forward incompatible syntax from Address.tpl

Before

Use of ` in the template is not forward compatible - see https://lab.civicrm.org/dev/core/-/issues/4146

After

image
The url on map still has location type id (lid - civicrm/contact/map?reset=1&cid=203&lid=1)

Technical Details

To r-run this I had to enable google geocoding with fake credentials AND add a fake geocode for the address

Comments

@civibot
Copy link

civibot bot commented Feb 24, 2023

No issue was found matching the number given in the pull request title. Please check the issue number.

@civibot
Copy link

civibot bot commented Feb 24, 2023

(Standard links)

@civibot civibot bot added the master label Feb 24, 2023
@demeritcowboy
Copy link
Contributor

I'll give this a quick run with a real geocode I just want to understand what is incompatible:

As far as I know this is not "old code" and in "modern" smarty the backticks still serve a purpose to allow e.g. putting expressions with a . in them inside quotes. So I'm wondering if the incompatibility is something introduced by the escape-by-default code. Having said that, I've always found the backticks confusing and breaking it out into an intermediate variable seems fine.

@demeritcowboy demeritcowboy merged commit 89f5b82 into civicrm:master Feb 28, 2023
@eileenmcnaughton eileenmcnaughton deleted the smarty-syntax branch February 28, 2023 01:54
@eileenmcnaughton
Copy link
Contributor Author

@demeritcowboy it hard fails on Smarty3

@demeritcowboy
Copy link
Contributor

It shouldn't, according to smarty docs. Are you using escape-by-default with it?

@eileenmcnaughton
Copy link
Contributor Author

@demeritcowboy hmm - it's toggling between the 2 smarty versions, not changing escape by default that matters. I think v3 is always escape by default

@demeritcowboy
Copy link
Contributor

It's just given all the other things that need fixing it would be good to determine if this is actually something that needs changing and what the incompatibility is caused by, since I expect there's a lot of backticks. Is it something like templates_c just needs clearing between toggling, because it compiles differently?

@eileenmcnaughton
Copy link
Contributor Author

@demeritcowboy it wasn't my impression that it was a common syntax - if you want to try firing up Smartyv3 it is possible with WIP patches + an extension & a define (you can toggle back & forth on the define) https://lab.civicrm.org/dev/core/-/issues/4146

@demeritcowboy
Copy link
Contributor

grep -r "`" templates | wc -l
gives 280 possible instances. So not insane but it takes up review time too.
I'll try it if I get a chance but no promises. If you already have the fail error message that might be useful.

@eileenmcnaughton
Copy link
Contributor Author

@demeritcowboy I'll grap some screenshots of the fatal error next time

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

Successfully merging this pull request may close these issues.

2 participants