4 Replies Latest reply on Feb 17, 2015 12:22 PM by WolfShade

    Detect if a scoped variable is corrupted???

    WolfShade Level 4

      Hello, everyone,

       

      I'm curious to know (this does not currently affect anything I'm working on.. I'm just curious) if there is a way to detect if a scoped variable (like "session.username" or "request.dsn") value has been corrupted?  Or if the variable, itself, has been corrupted?

       

      V/r,

       

      ^_^

        • 1. Re: Detect if a scoped variable is corrupted???
          BKBK Adobe Community Professional & MVP

          What do you mean by corrupted? The value of session.username mysteriously changing from 'bkbk' to '%8#A&o'? The variable name mysteriously changing from session.username to session.usrnm or just username? It is unclear so far what you mean.

           

          Furthermore, the qualification, 'scoped', may be redundant. Practically every ColdFusion variable has a scope.

          • 2. Re: Detect if a scoped variable is corrupted???
            WolfShade Level 4

            Hi, BKBK!

             

            I'm not exactly sure what happened (it was over a year ago, I think), but on a project that I was working on used <cfif StructKeyExists(session,"userID")> to check for authentication.  There were a lot of users who would log on, and after a few hours were getting weird error messages, and as far as we could tell, the session.userID was present, but the value contained within was not a valid userID.  So, either the variable itself was corrupted, or the value within was corrupted, somehow.

             

            I'd like to avoid situations like that in the future, so I'm wondering if there is a way to detect if corruption has occurred for a variable in the session scope.

             

            V/r,

             

            ^_^

            • 3. Re: Detect if a scoped variable is corrupted???
              BKBK Adobe Community Professional & MVP

              Ah, thanks for the explanation, WolfShade.

              From your description, there might be a subtle loophole in the code logic. It just might be that session.userID is defined in certain circumstances where the user is not logged in.

               

              If you could use another pair of eyes, I would review the relevant piece of code for you. If necessary, send it by private message.

              • 4. Re: Detect if a scoped variable is corrupted???
                WolfShade Level 4

                Honestly, that project was so long ago that I don't even remember which project it is!  I think we just wrote it off as a glitch, and told everyone who experiences it to just try, try again. 

                 

                Still.. I just happened to think of it, and was curious to know if it were possible.

                 

                Thanks,

                 

                ^_^