Lucee - Coldfusion new keyword not working
Asked Answered
I

1

6

I am trying to invoke a component using the new keyword but it is not working.

The following method below works fine:

<cfset test = CreateObject("component", "test-objects.shipping_new").init(bar="Blah", foo="boom")>

But when I try to use the following:

<cfset test = New test-objects.shipping_new(bar="Blah", foo="boom") />

I get the error tag cfset is not closed. The code above is the first line in the file I am trying to invoke it from, unless I am missing something the tag looks closed to me. I am using Lucee 4.5 if that makes a difference.

Iou answered 30/3, 2016 at 16:34 Comment(0)
S
9

The problem is the hyphen:

If the folder name or CFC name has hyphen, use the following syntax:

cfObject=new "cfc-path"(constructorParam1,...)

Spoke answered 30/3, 2016 at 16:40 Comment(2)
What a pain but that was it! thank you for your helpIou
It's a bug in ColdFusion, there is zero need for this to be an error. There are several weird inconsistancies in allowed filename characters in CF and lucee. It's about time they fixed these bugs with hyphens, and dotsMonospermous

© 2022 - 2024 — McMap. All rights reserved.