invoke function doesn't support same scope calls

Description

According to the official ACF docs for invoke:

invoke(instance, methodname [, arguments])

instance: String or component object; a reference to a component, or component name/path to instantiate. Can be an empty string when invoking a method within the same ColdFusion page or component.

The following code works in all versions of ACF, while Lucee throws: lucee.runtime.exp.ExpressionException: invalid component definition, can't find component []

<cfscript> function foo(x) { return arguments.x; } z = invoke("", "foo", { x: "y" }); writeOutput(z); </cfscript>

The Lucee docs do not mention the empty string. Passing the THIS scope in a component does work. Passing the VARIABLES scope in a regular cfm template does not work however.

Activity

Show:

Pothys - MitrahSoft 2 August 2022 at 08:32

I've checked this ticket with the lucee latest build 6.0.0.219-SNAPSHOT. Now using an empty string in invoke() lucee invokes the method.

Pothys - MitrahSoft 12 July 2022 at 13:15

I added a fix to this ticket. By this fix, the invoke() function with the empty string as input will invoke the method from the same cfm page or component.

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

Pothys - MitrahSoft 20 September 2021 at 11:56

I've checked this ticket and confirmed the issue happened on lucee latest version 5.3.9.10-SNAPSHOT too. Using empty string in invoke() throws an error as above mentioned. Seems ACF invokes the method from the same cfm page/cfc.

I added a testcase to this ticket
Pull Request: https://github.com/lucee/Lucee/pull/1434

but using variables scope in cfm page, lucee invokes the method from the same page. Could you please check this and report it here back?

Fixed

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Fix versions

Affects versions

Priority

Created 15 September 2021 at 13:31
Updated 18 September 2024 at 10:16
Resolved 2 August 2022 at 08:32