tracker issue : CF-4201173

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

isValid VariableName marks invalid variable names as valid if they have a period in them

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Dave Levin / Dave Levin ()

Created: 02/14/2018

Components: Language, Functions

Versions: 2016,11.0,10.0

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2016 Update 5 / 2018,0,0,308494

Priority/Frequency: Normal / Few users will encounter

Locale/System: ALL / Win 2012 Server x64

Vote Count: 0

Problem Description: If you run isValid("variableName") on an invalid variable name that has a period in it, you will get a true (is valid) response.

Steps to Reproduce:
Run the following code:

<cfoutput>

	<h2>Is Valid Variable Name Test</h2>

	<ul>
		<li>apple: #isValid("variableName", "apple")#</li>
		<li>4apple: #isValid("variableName", "4apple")#</li>
		<li>apple?: #isValid("variableName", "apple?")#</li>
		<li>4;apple: #isValid("variableName", "4;apple")#</li>
		<li>4;https://apple:443/apple/apple?: #isValid("variableName", "4;https://apple:443/apple/apple?")#</li>
		<li>4;https://apple:443/apple/apple.apple?: #isValid("variableName", "4;https://apple:443/apple/apple.apple?")#</li>
		<li>4;https://apple:443/apple/apple.4apple?: #isValid("variableName", "4;https://apple:443/apple/apple.4apple?")#</li>
	</ul>

</cfoutput>

Actual Result:
apple: YES
4apple: NO
apple?: NO
4;apple: NO
4;https://apple:443/apple/apple?: NO
4;https://apple:443/apple/apple.apple?: YES
4;https://apple:443/apple/apple.4apple?: YES

Note: The function will see a period in the variable name and automatically assume it is valid.

Expected Result:
apple: YES
4apple: NO
apple?: NO
4;apple: NO
4;https://apple:443/apple/apple?: NO
4;https://apple:443/apple/apple.apple?: NO
4;https://apple:443/apple/apple.4apple?: NO

Any Workarounds:
None. You'll need to rely on your own validation

Attachments:

Comments: