Quantcast
Channel: Adobe Community : Discussion List - ColdFusion
Viewing all articles
Browse latest Browse all 6243

IsDefined doesn't like variable names beginning with a number. Unless they are defined...

$
0
0

Hello,

 

I have detected a weird (to me) behaviour of the IsDefined function. I have something like:

 

<cfif IsDefined("url.vose")><cfset somevariable="some value"></cfif>

<cfif IsDefined("url.3d")><cfset somevariable="some value"></cfif>

 

* if url.3d is defined, good. All works as expected.

* if url.3d is not defined, CF throws a "Parameter 1 of function IsDefined, which is now url.3d, must be a syntactically valid variable name" error.

* if I use structKeyExists(url,"3d") instead of IsDefined("url,3d"), works as expected.

 

I tried with different combinations of variable names and scopes (pe, url.5d or form.3d) and the problem seems to be the number at the beginning of the variable name.

 

Is this the expected behaviour? I found very strange that it works if the variable exists and only throws an error if not. Could this be considered a bug and should be reported?

 

TIA,


Viewing all articles
Browse latest Browse all 6243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>