tracker issue : CF-4146924

select a category, or use search below
(searches all categories and all time range)
Title:

Null variables with same name as property are not resolved correctly

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/AsDesigned

Reporter/Name(from Bugbase): Doug Giles / Doug Giles (Doug Giles)

Created: 04/29/2016

Components: Language, Functions

Versions: 2016

Failure Type:

Found In Build/Fixed In Build: CF2016_Final /

Priority/Frequency: Normal / Few users will encounter

Locale/System: ALL / Windows 7 SP1 64-bit

Vote Count: 0

Problem Description:
Null variables with same name as property are not resolved correctly

If a local variable is declared in a function in a CFC, and the local variable has the same name as a property in the CFC, and has a null value, CF 2016 appears to access the value of the property instead of the value of the local variable where the local variable is in scope.


Steps to Reproduce:
A zip file is attached that demonstrates the bug.  The zip file contains 3 files:
+ Application.cfc
+ index.cfm
+ artist.cfc

The demo uses the cfartgallery datasource.

Running the demo in CF 9 and CF 2016 produces different results.

The new searchImplicitScopes application variable in CF 2016 does not appear to affect the results.


Actual Result:
In CF 2016, the IsNull() function seems to access the value of the property (instead of the local variable).


Expected Result:
In CF 2016, the IsNull() function seems to correctly access the value of the local variable.


Any Workarounds:
A workaround would be to not use local variables that have the same name as a property.  That might not be a realistic workaround for users who have a large codebase and want to upgrade to CF 2016.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4146924

External Customer Info:
External Company:  
External Customer Name: Doug Giles
External Customer Email:  
External Test Config: My Hardware and Environment details:

CF 2016: Windows 7 SP1 VM, 32-bit; ColdFusion 2016,0,0,298074

CF 9: Windows 7 SP1, 64-bit; ColdFusion 9,0,2,282541

Attachments:

  1. April 29, 2016 00:00:00: 1_cf2016-bug-demo.zip

Comments:

I don't know what the frequency will be, but if it occurs, the results can be severe. This bug may be related to bug CF-4119653, but seems different.
Comment by External U.
2986 | April 29, 2016 09:32:08 AM GMT
The change of behaviour is a fix rather than a regression. IsDefined and so IsNull should honor the scope lookup and based on precedence. Previous versions were not doing the lookup and that was partially fixed as part of bug # CF-3556075 SearchImplicitScopes setting does not effect the Variables scope. The scopes it effects are (CGI,URL,FORM,Coockie,File,Client Scope) as per checkin #291979 For the current scenario to work, user will have to scope the variable.
Comment by Himavanth R.
2987 | June 07, 2016 10:17:55 PM GMT