I'm seeing a very odd and very troubling behavior in CF, which I'm hoping
someone can shed some light on or just confirm the oddity.  It appears that
"NaN" is a reserved word in CF, presumably because it is the "Not a Number"
constant in Java", even though it shouldn't be.  Dump this code in a page
and try it in CF (I'm using 7):

<cfset s = "one">
<cfset test = (s is "1")>
<cfoutput>#test#</cfoutput>

<cfset s = "NaN">
<cfset test = (s is "one")>
<cfoutput>#test#</cfoutput>

<cfset s = "NaN">
<cfset test = (s is "1")>
<cfoutput>#test#</cfoutput>

Now, I would _expect_ the code to generate "No No No".  But guess what
happens . . . The first two statements work fine, but the third one throws a
*type conversion* error.  More specifically, it throws "The value "NaN"
cannot be converted to a number".

Type-less language, my backside!  Why is it trying to do a number conversion
here?  I even have the "1" in quotes, for Pete's sake.  It doesn't even work
if I add spaces around it, as in " NaN " or " 1 ".  And it gets even
_sloppier_ . . . this only occurs if you use the capitalization "NaN".
"NAN", "Nan", "nan", etc. work just fine.  Since when is CF
case-sensitive??!?!?!

Now here's why it's a problem - "NAN" is a perfectly valid user-input
statement in our system (think stock symbols).  So now whenever we perform
user-validation, we have to have a special filter for "NaN" and make sure it
is converted to either all upper or all lower case!

Does anyone else find this frightening?

Does anyone know where the link to report CF bugs went?

Roland





----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to