tracker issue : CF-3631104

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

isvalid("variableName") incorrectly validates strings with leading/trailing spaces or ending period

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): James Moberg / James Moberg (James Moberg)

Created: 09/12/2013

Components: Language

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final / 287432

Priority/Frequency: Major / All users will encounter

Locale/System: English / Win 2008 Server R2 64 bit

Vote Count: 1

Problem Description: isvalid("variableName") documentation indicates that it validates a string formatted according to the ColdFusion variable naming conventions.  The variable naming convention indicates that it must begin with a letter, underscore, or Unicode currency symbol and not cannot contain spaces. You cannot use periods in simple variable names, with the exception of variables in the Cookie and Client scopes

It appears that strings with leading or trailing spaces are incorrectly identified as valid variable names.  (I pasted the code below into and Railo correctly identifies all strings as invalid variable names.)

Steps to Reproduce:
<cfloop list="abc., abc,abc , abc " index="this">
"#this#" = #isvalid("variableName", this)#<br>

Actual Result:  Strings with leading or trailing spaces are valid.  Strings ending with a period are valid.

Expected Result:  Any strings with any spaces should not be identified as valid variable names. Strings ending with a period should not be valid.

Any Workarounds:  None.

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

Watson Bug ID:	3631104

Deployment Phase:	Release Candidate

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

ColdFusion 10,0,11,285380 (Dev)

Windows Server 2008 R2 (64bit)



This bug also exists in ColdFusion 8 & 9.
Comment by External U.
14517 | September 12, 2013 03:41:57 PM GMT
Not something I use often, but should work. -- Adam
Vote by External U.
14522 | September 13, 2013 09:04:58 AM GMT
This issue will be fixed in the upcoming major release.
Comment by Nimit S.
14518 | December 18, 2013 01:44:32 AM GMT
What about IP addresses & user agent strings? I validated both of those using isValid("variableName") and ColdFusion indicated that they were both valid ColdFusion variable names. Here's a CFTry test and comparison with a UDF that I wrote. You can compare the results against ColdFusion 10, 11, Railo & Lucee.
Comment by External U.
14519 | August 04, 2015 07:57:45 AM GMT
It also appears that ColdFusion doesn't validate unicode currency symbols as part of the variable name. Are there any samples of this in use and working as advertised?
Comment by External U.
14520 | August 04, 2015 07:59:50 AM GMT
There are other issues with isValid() when it comes to trailing spaces in the value being evaluated. I'm not sure if this needs to be a new bug as it's the same "trim" isValid() issue affecting other evaluation types. IsBoolean() returning true for "123D ", but false for "123D"?
Comment by James M.
14521 | July 19, 2017 01:32:19 PM GMT