4 Replies Latest reply: Feb 28, 2013 12:15 PM by Adam Cameron. RSS

    Weird transaction issue with implicit struct (and possible array)

    Jeremy Tan

      I have the following 2 files.

      mycfc.cfc

      <cfcomponent  output="false">

       

                <cffunction name="set" output="true" returntype="void">

                          <cfargument name="text1" type="string" required="true">

                          <cfargument name="something" type="any" required="true">

                          <cfdump var="#arguments#">

                </cffunction>

       

      </cfcomponent>

       

      mycfc.cfm

      <cfscript>

                test = {firstName="Bob in line 2"};

                i=1;

                transaction {

           new mycfc().set(Text1:"hello",something:"Bob in text");

           i++;

           new mycfc().set(Text1:"hello",something:"Bob in text again");

           new mycfc().set(Text1:"hello",something:test);

           new mycfc().set(Text1:"hello",something:{firstName="Bob in line 9"});

           test2 = {firstName="Merry"};

           writeDump(var=test2,label="line 11" );

           new mycfc().set(Text1:"hello",something:{firstName="Jenny"});

           i++;

           new mycfc().set(Text1:"hello",something:{firstName="Jenny 2"});

                }

                writeDump("i = #i#");

      </cfscript>

       

       

      If you run the mycfc.cfm, you will notice 4 weird things here.

      1) new mycfc().set(Text1:"hello",something:test); should output "Bob in line 2", but is replace with "Bob in line 9"

      2) my dump with label="line 11" is missing.

      3) duplication of "Jenny 2", even you remove the writedump, you still get double "Jenny 2".

      4) writeDump("i = #i#"); will give you "i = 2", which should be i = 3

       

      This problem only happen when using transaction. It is happen to both CF9 and CF10