Unexpected scope lookup with VARIABLES and ARGUMENTS name conflict


The situation is that I have a function in a script block, and the function has an argument with the same name as a variable in the outer variables scope. In my function code, I reference the argument but, when I call it, I passed in no value.

I think the code should have thrown an error, telling me that the argument I'm obviously referenced hasn't been defined. Lucee instead looked up into the variables scope and found the variable there. I feel like this is unexpected behavior as it's obvious that my code meant to reference the arguments scope.

There is no issue if I pass a value to the function. There is also no issue if I define a default value or require the argument. It's only in this example, which is a logic error, that I see the unexpected behavior.

I see this same behavior in Lucee running as CFML dialect and Lucee dialect. I did my testing in the Lucee dialect.




Michael Offner


Miles Rausch




Fix versions

Affects versions