Difference in CALLER scope assignment between ACF and Lucee

Description

I just noticed a small difference in the way ACF and Lucee treat `CALLER` scope assignment, specifically with regard to how keys with dots work. Assuming that I have this line in a ColdFusion custom tag:

In ACF, that will store foo into the url scope.

In Lucee, that will store url.foo into the variables scope.

Small but interesting difference. I wrote it up here: https://www.bennadel.com/blog/3995-divergent-caller-scope-assignment-behavior-in-adobe-coldfusion-and-lucee-cfml-5-3-7-48.htm

Activity

Show:
Pothys - MitrahSoft
March 4, 2021, 1:44 PM

I've checked this ticket and confirmed the issue happened on lucee latest version 5.3.8.149-SNAPSHOT also. Custom tag assigns the values to URL scope using caller was stored in variables scope instead of URL. Seems ACF works fine. Above mentioned workaround for this issue, using cfparam and setvariable() to assign value are works fine. I added a testcase for this ticket.

Pull Request: https://github.com/lucee/Lucee/pull/1220

Ben Nadel
February 26, 2021, 2:20 PM
Edited

Over on twitter, mentioned that you could probably use setVariable() for this as well. As in:

Which, I think, does the same thing that the <cfparam> approach does, but with a more semantic invocation (note that I have not tested this)

Ben Nadel
February 26, 2021, 12:29 PM
Edited

Actually, I did just try changing:

to:

… using dot-notation instead of bracket-notation, and it seems to work consistently in both ACF and Lucee. So, at least that’s maybe a valid work-around. Though, of course, that means using the <cfparam> tag to set values into the caller scope instead of using direct assignment.

Ben Nadel
February 26, 2021, 12:26 PM

As per my discussion with , one such use-case for this might be if you wanted to create a custom implementation of the cfparam tag. Imagine a ColdFusion custom tag that looked like this, using the <cfparam> tag under the hood to perform the assignment, but wrapping its invocation in a try/catch block with custom error handling:

Then, I could consume this ColdFusion custom tag as such:

In ACF, this generates:

url.foo => “woot woot!”

And in Lucee, this generates:

variables[ 'url.foo' ] => “woot woot!”

Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Michael Offner

Reporter

Ben Nadel