Fixed
Details
Assignee
Michael OffnerMichael OffnerReporter
Miles RauschMiles RauschPriority
NewLabels
Fix versions
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
Affects versions
Details
Details
Assignee
Michael Offner
Michael OffnerReporter
Miles Rausch
Miles RauschPriority
Labels
Fix versions
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
Affects versions
Created 13 April 2015 at 15:08
Updated 5 October 2015 at 14:45
Resolved 5 October 2015 at 14:45
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.
<:script> msg = 'Hello'; function exclaim( msg ) { var exclamation = msg & '!'; dump( exclamation ); } function exclaim2( msg = '' ) { var exclamation = msg & '!'; dump( exclamation ); } exclaim(); // Should error, but shows 'Hello!' exclaim('Goodbye'); // Shows 'Goodbye!' exclaim2(); // Shows '!' </:script>
I see this same behavior in Lucee running as CFML dialect and Lucee dialect. I did my testing in the Lucee dialect.