WHY ALL THE YELLING?

Posted on September 20, 2007 at 4:03 PM in ColdFusion

Okay, I've been playing with ColdFusion for over ten years now. During that time, naturally, I've always noticed that when you define variable names and then <cfdump> them, CF converts them to UPPERCASE.

For example...

  1. <cfscript>
  2. myStruct = structNew();
  3. myStruct.key1 = "foo";
  4. myStruct.key2 = "bar";
  5. </cfscript>
  6. <cfdump var="#myStruct#" />

This code will result in the following:

To me, this particular behavior isn't really that big of a deal. I mean, after all, it did help me in establishing a naming convention. For instance, with my database field names, I always separate "words" with an underscore (_). It helps me read the resulting query dump better when I'm testing things out. Besides, if I really am intent on having the variable names be in precisely the cAsE that I enter them, that's pretty easy to get around. Take the following, for example...

  1. <cfscript>
  2. myStruct = structNew();
  3. myStruct['kEy1'] = "foo";
  4. myStruct['kEy2'] = "bar";
  5. </cfscript>
  6. <cfdump var="#myStruct#" />

This code will result in the following:

Now the key names are exactly as I typed them. Cool.

So then, what prompted this post? Well, I am working on a payment gateway integration, and when sending the XML to the host server, naturally, a hash is required to be sent along with it, to verify the authenticity of the request. The hash is built by concatenating various pieces of the request together, hashing that, and then concatenating yet another piece of information to the resultant hash, and hashing it.

Dummy me, I didn't pay any attention to the fact that the hashes from CF were in UPPERCASE, while the hashes in the developer's guides produced by the payment service were in lowercase. As a result, I spent over a week going back and forth with them trying to figure out what was wrong. All because CF defaults everything to UPPERCASE.

Getting around that is simple enough as well...

  1. <cfscript>
  2. myHash = lCase(hash("myString", "SHA"));
  3. </cfscript>

Hopefully this post will help others not waste as much time as I did on this little issue. But, if you're reading this and know the answer to the following question, please add your comment!

Why does ColdFusion YELL SO MUCH?

Comments
(Comment Moderation is enabled. Your comment will not appear until approved.)
CodeBassRadio

Latest Articles

Eventually something really brilliant and witty will appear right here.

Calendar

June 2026
S M T W T F S
« May  
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        

Subscribe

Enter a valid email address.

The Obligatory Wish List