I try it for CF 4.5 Server Prof on Win2K Prof. Have the same problem. Double Log entry for no cfoutput.
----- Original Message ----- From: "Garza, Jeff" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Tuesday, December 11, 2001 12:04 PM Subject: RE: Templates executing twice CF bug > Ran your test code and I only got a single log entry. Running CF5 Single > User on Win2kPro. Will try in the morning on Full Enterprise CF5 on > Advanced Server. > > Jeff Garza > Webmaster/Lead Developer > Spectrum Astro, Inc. > [EMAIL PROTECTED] > > -----Original Message----- > From: Max Paperno > To: CF-Talk > Sent: 12/10/01 9:29 PM > Subject: Templates executing twice CF bug > > Greetings, > > I've identified a somewhat minor but possibly damaging bug in CF 5. > It's pretty strange, but true. Zac Belado has confirmed that this was > also the problem in his case (see his "Page Processing Twice" message > from earlier today). It seems to only affect CF5 (4.5 was also tried) > but so far only tested on W2K. > > The bug causes a template to be executed twice by the CF engine. It > literally runs everything connected to the request twice (all includes, > parent template, etc). There is no indication of this unless you have > data that is noticeably affected (such as inserting DB records). The > HTTP request is not doubled, only the actual CF code execution. This is > not browser or Web server-related in any way. > > The cause seems to be missing cfoutput tags around a variable call, and > apparently specifically in an IMG tag (some others were tried with no > problems surfacing). So some code like this: > > <img src="#variables.someVariable#/test.gif"> > > (w/out cfoutput tags anywhere around it) will cause double execution. > Wrap it in cfoutputs (or in comments) and the problem goes away. > > Strange, no? > > So strange that I wrote a test for this. I've pasted my test template > below, but if your email client makes it unreadable then you can also > download a version here <http://www.WorldDesign.com/CF/BugTest.cfm.txt>. > Instructions are in the comment. I'll also submit this to MM. > > Comments welcome. > > Cheers, > -Max > > > BugTest.cfm > ------------------- > <!--- > This test template demonstrates an apparent bug in ColdFusion > v.5 that causes a template to be executed twice per request. > > Run this template and look for a file named BugTestLog.txt in the same > folder as the template. It should have 2 entries with exact same > date/time stamp every time you request this template. As you can see > there is no HTTP redirection/reload involved and the browser only > requests the template once (check your web server log to verify). There > is apparently no way to tell that the execution is happening twice > except by looking at external events (like the log file double entry in > this example). > > The cause seems to be missing cfoutput tags around a variable call, and > apparently specifically in an IMG tag (some others were tried with no > problems surfacing). Putting cfoutput or CF comment tags around the > variable call will solve the issue (try it and then check the log file > -- you should now only see one time stamp per request). > > So far this has only been confirmed on CF5 with Windows 2000. CF 4.5 on > NT4 was also tried and did not exhibit this behavior. > > [EMAIL PROTECTED] 12/10/01 > ---> > > <cfset logDir = GetDirectoryFromPath(GetCurrentTemplatePath())> > <cfset logFile = logDir & "BugTestLog.txt"> > <cflock timeout="5" throwontimeout="Yes" name="writeTestLogFile" > type="EXCLUSIVE"> > <cffile action="APPEND" file="#logFile#" output="Ran at #Now()#" > addnewline="Yes"> > </cflock> > <cfset someVariable = "test"> > > <!--- the presence of the following line without cfoutput tags > around it will cause this template to execute twice ---> > > <img src="#variables.someVariable#/test.gif"> > > > > ----------------------------- > Maxim Paperno, CTO > World Design Group, Inc. > [ CF Development and Hosting since 1996 ] > <http://www.WorldDesign.com/> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists