• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Detect if a scoped variable is corrupted???

LEGEND ,
Feb 13, 2015 Feb 13, 2015

Copy link to clipboard

Copied

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,

^_^

Views

206

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 14, 2015 Feb 14, 2015

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 16, 2015 Feb 16, 2015

Copy link to clipboard

Copied

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,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 16, 2015 Feb 16, 2015

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 17, 2015 Feb 17, 2015

Copy link to clipboard

Copied

LATEST

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,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation