of course as you are checking for url.myvar which doesn't exist as you created variables.myvar not url.myvar.
On Wed, Sep 1, 2010 at 5:24 PM, John M Bliss <bliss.j...@gmail.com> wrote: > > > dot notation means nothing to isdefined() > > Um, really? The following returns "NO" for me: > > <cfset variables.myvar = 1> > > <cfoutput>#IsDefined("url.myvar")#</cfoutput> > > > On Wed, Sep 1, 2010 at 11:16 AM, Russ Michaels <r...@michaels.me.uk> > wrote: > > > > > it depends how many vars you have in each scope. > > If you have barely any then the search will be quick. > > If you have a complex app with hundreds of vars then the result will of > > course be different, especially if they are complex structs. > > > > There is also the fact that isdefined() will find the variable in ANY > > scope, > > which may not be the one you want. > > > > e.g. > > isDefined('myvar') > > would find > > > > variables.myvar > > cookie.myvar > > session.myvar > > > > etc > > so if you are actually looking for myvar only in the form scope then this > > could cause you issues, you also need to remember that dot notation means > > nothing to isdefined(), so isDefined('form.myvar') could also find > > > > session.form.myvar > > url.form.myvar > > cookie.form.var > > > > etc > > > > On Wed, Sep 1, 2010 at 4:56 PM, Mark A. Kruger <mkru...@cfwebtools.com > > >wrote: > > > > > > > > Russ, > > > > > > You are correct about that - but it's not typically a performance > problem > > > in > > > my view. More of a "buggy/security" type problem :) > > > > > > -Mark > > > > > > Mark A. Kruger, MCSE, CFG > > > (402) 408-3733 ext 105 > > > Skype: markakruger > > > www.cfwebtools.com > > > www.coldfusionmuse.com > > > www.necfug.com > > > > > > > > > > > > -----Original Message----- > > > From: Russ Michaels [mailto:r...@michaels.me.uk] > > > Sent: Wednesday, September 01, 2010 10:51 AM > > > To: cf-talk > > > Subject: Re: CFParam vs. IsDefined > > > > > > > > > defo better to make sure they are defined. > > > Also using isDefined() is also bad as this search every single scope > for > > > your variable and is thus quite slow and can potentially cause > timeouts. > > > Much better to use StructKeyExists() and only test the scope your > > variable > > > is in. > > > > > > -- > > > Russ Michaels > > > www.cfmldeveloper.com > > > Supporting the cf community since 1999 > > > FREE ColdFusion/Railo hosting for developers. > > > > > > > > > On Wed, Sep 1, 2010 at 4:40 PM, DURETTE, STEVEN J (ATTASIAIT) < > > > sd1...@att.com> wrote: > > > > > > > > > > > Using your way ensures that any variables that you are using already > > > > exist. > > > > > > > > I was always taught that I should define my variables before I use > them > > > > in code (my ancient programming college courses). So, I tend to > follow > > > > your method. > > > > > > > > Also, from a security stand, you should already know what should be > > > > coming into your page. If it isn't there then something went wrong. > And > > > > if you didn't define it and it is there you should be ignoring it. > > > > > > > > Steve > > > > > > > > -----Original Message----- > > > > From: Michael Grant [mailto:mgr...@modus.bz] > > > > Sent: Wednesday, September 01, 2010 11:36 AM > > > > To: cf-talk > > > > Subject: CFParam vs. IsDefined > > > > > > > > > > > > I prefer to CFParam my vars with a default value of a zero len string > > or > > > > a 0 > > > > for numeric values. Then I skip the isdefined and just test against > the > > > > value. Well recently someone I know said that it's better to test if > > > > it's > > > > defined. Is there a pro or con to doing it my way vs. IsDefined ? > > > > > > > > Thanks. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336727 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm