Skip to main content
Known Participant
September 10, 2009
Answered

Need help... Context validation error for tag cfscript.

  • September 10, 2009
  • 1 reply
  • 5444 views

Code:

    <cffunction name="computeHash" access="public" returntype="String">
      <cfargument name="password" type="string" />
      <cfargument name="salt" type="string" />
      <cfargument name="iterations" type="numeric" required="false" default="1024" />
      <cfargument name="algorithm" type="string" required="false" default="SHA512" />
      <cfscript>
        var hashed = '';
        var i = 1;
        hashed = hash( password & salt, arguments.algorithm, 'UTF-8' );
        for (i = 1; i <= iterations; i++) {
          hashed = hash( hashed & salt, arguments.algorithm, 'UTF-8' );
        }
        return hashed;
      </cfscript>
    </cffunction>

Error on web app:

Context  validation error for tag cfscript.

The start tag must have a matching  end tag. An explicit end tag can be provided by adding </cfscript>. If the  body of the tag is empty you can use the shortcut <cfscript .../>.

The CFML compiler was processing:

  • a cfscript tag beginning on line 11, column 12.
  • a cfscript tag beginning on line 11, column 12.
The  error occurred in xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\salty.cfc: line  11
9 :        <cfargument name="iterations" type="numeric" required="false" default="1024" />
10 :        <cfargument name="algorithm" type="string" required="false" default="SHA512" />
11 :        <cfscript>
12 :           var hashed = '';
13 :           var i = 1;

I am completely lost on why it's fumbling with why it says there's no closing tag.  Help!!!!

Thanks

    This topic has been closed for replies.
    Correct answer Adam Cameron.

    What's on lines 1-7 of that file?

    That code compiles fine for me on CF8 & CF9, so that's not where the error is.

    You're not trying to compile it on any earlier version of CF than CF8 are you?  The < and ++ operators are not valid prior to CF8.  CFMX7 might see the < as a stray angle bracket, and get confused.  I don't have CFMX7 running here to test the exact error that would produce, sorry.

    --

    Adam

    1 reply

    Adam Cameron.Correct answer
    Inspiring
    September 10, 2009

    What's on lines 1-7 of that file?

    That code compiles fine for me on CF8 & CF9, so that's not where the error is.

    You're not trying to compile it on any earlier version of CF than CF8 are you?  The < and ++ operators are not valid prior to CF8.  CFMX7 might see the < as a stray angle bracket, and get confused.  I don't have CFMX7 running here to test the exact error that would produce, sorry.

    --

    Adam

    Known Participant
    September 10, 2009

    I am running MX7.

    Looks like you are correct.

    Also, my algorithm apparently isn't supported in CF7 either

    edit: nvm, it's not SHA512, it's SHA-512 in CF7.