Ran into an interesting thing. This code works fi...
# cfml-general
m
Ran into an interesting thing. This code works fine:
Copy code
<cfset local.result = getModel("personS").PMRoleUpdateProductPosition(
	listToArray(arguments.rc.productIDs).map((product_id) => {
		return {
			product_id = arguments.product_id,
			context_type = rc.context_type
		};
	}),
	arguments.rc.contextStatus,
	arguments.rc.person_id
) />
until I make some other seemingly unrelated changes somewhere else in the file, far away, like changing this
Copy code
<cfif
  (...
to this
Copy code
<cfif (...
and this
Copy code
<cfif blah>
  <!--- some comment --->
to this
Copy code
<cfif blah> <!--- some comment --->
Then, CF is like unhandled exception "Invalid CFML construct found on line n" complaining about the
}
character on the 7th line of the first bit of code. If I refactor it a bit to this, no complaints and it runs fine:
Copy code
<cfset local.productsArray = listToArray(arguments.rc.productIDs) />
<cfset local.productsWithTypes = local.productsArray.map((product_id) => {
	return { product_id = arguments.product_id, context_type = rc.context_type };
}) />
<cfset local.result = getModel("personS").PMRoleUpdateProductPosition(local.productsWithTypes, arguments.rc.contextStatus, arguments.rc.person_id ) />
Why would the exact same code not have a syntax error before those unrelated, distant changes, but die once they're made?
a
I'm wondering if it's some tokenization bug in CF itself.
Probably this. It would not be the only one. And use threads pls.
m
ah, sorry about ๐Ÿšซ ๐Ÿงต
a
It's nae bother.
It was a request, not an admonishment
m
gotcha - no worries
a
Which version of CF is this? Just as a test can you use an ordered struct not a standard one, to see if the confusion goes away? EG:
Copy code
return [ product_id = arguments.product_id, context_type = rc.context_type ];
And if using that, you could actually ditch the other
{}
for the callback, and the
return
Copy code
<cfset local.result = getModel("personS").PMRoleUpdateProductPosition(
	listToArray(arguments.rc.productIDs).map((product_id) => [
		product_id = arguments.product_id,
		context_type = rc.context_type
	]),
	arguments.rc.contextStatus,
	arguments.rc.person_id
) />
m
we're on 2018 still
a
Ah OK
If you could distill it down to a minimal repro case I'm sure @Mark Takata (Adobe) would love to know about it.
m
๐Ÿ™‚ I'll see if I can get some time. rn we're in a bit of a hair on fire production fixes mode
โค๏ธ 1
โœ… 1