Session issues after installing Coldfusion 9.01 update - OnRequestEnd behaviour change

Finally got to the bottom of an session problem we've been having with a heavily-trafficked live server since we installed the Coldfusion 9.01 update, Hotfix 1 (CHF1) for ColdFusion 9.0.1 and the hotfix for security bulletin APSB11-04

Essentially, users appeared to be losing session information in between requests. Now, there is a known issue with the fix for APSB11-04, to with the Session Fixation issue, so this part of the fix can be turned off using a JVM switch (see the technote above).

But even after implementing this workaround, we were having an issue with some sessions (fewer, but still a lot) appearing to being lost.

It took quite a while to get to a solution, as we thought we were dealing with the problem noted above, but we finally nailed this down to a change in Coldfusion's behaviour after cflocation, and in fact our problem was not with the session scope but with the request scope.

Ben Nadel has blogged about this change as a change from Coldfusion 8 to Coldfusion 9, but as far as we can see it is actually a change between 9 and 9.01.

Essentially, in versions prior to 9.01, the 'OnRequestEnd' method in application.cfc would not be called if a cflocation took place before the end of the request i.e. a request with a cflocation in it would never actually 'end' - just the new request indicated in the cflocation would start.

In Coldfusion 9.01, the OnRequestEnd method is always fired, whether you cflocation before it or not.

In our case the problem was caused by a cflocation to enforce the use of https on certain templates - if https was 'off', we would cflocation to a 'https' url. But, we were setting a request variable that the OnRequestEnd method expected to exist *after* we did the cflocation.

In the past, that didn't matter, as onRequestEnd never got fired. Now, all code after the cflocation is abandoned (as before), but onRequestEnd *does* fire. And doesn't find the request variable it expects, and then errors.

So the simple answer is... if your onRequestEnd expects a variable to exist, make sure you either cfparam it in onRequestEnd, or set it before you do any cflocations.

[If you dig far enough in the release notes for 9.01 you will find this mentioned as a 'fix' - but I personally would call it a change of behaviour rather than a 'fix'!]

Event Photography Website Development

Horisk have just completed web development on a bespoke e-commerce website for the specialist Scottish event photographers Xpressphoto.

As well as full information about the business, photography portfolios and a Search Engine Optimised blog, the site incorporates custom developed e-commerce galleries. The generous image sizes and number of images per page easily allows customers to quickly browse all photos of an event, add their chosen shots to a basket and pay online.

The back-end allows Xpressphoto to fully customise their product offerings e.g. pricing and descriptions. Preview images are uploaded by ftp, where they can be sorted into galleries and categories, with thumbnail images being auto-generated.

The site is currently integrated with Paypal for payment processing, but will soon be switching to integrate with Protx to process payments for Barclaycard Merchant Services.

The site uses a combination of Coldfusion and PHP to power the blog, images galleries and e-commerce functions.

Wedding Photography Website

Horisk have just put a new website live for Scottish wedding photographer Rhoddy Stewart.

Scottish Wedding PhotographerThe site uses a Wordpress backend for which Horisk designed new templates to best display Rhoddy's powerful images. As well as weddings, Rhoddy also produces beautiful lifestyle portraits and has a separate event photography business.

We are currently working on a Coldfusion-based print ordering system, so wedding guests can view the images in password protected galleries and order wedding photographs online.

5 Things to consider when making the 15% VAT Rate Change

Well that's put the cat among the pigeons.

5 working days for every retailer in the UK to change their databases, accounting systems and e-commerce websites to reflect a new VAT rate.

We've already had a couple of new customers phone us for help, either with updating their Filemaker Pro databases or Coldfusion websites to reflect the VAT rate change.

If the system has been well designed in the first place, this should be relatively straightforward. But with the VAT rate not having changed since 1991, there is always the chance that a developer has taken a shortcut and hardcoded it somewhere.

The VAT rate should be stored in one global variable that can be simply changed. Hopefully this is in a database field that the system administrator can access - but it may be buried in a preferences or application file in the code somewhere only a developer can find it. Or worse, it may have been hardcoded into calculations all over the place (as we found in one case today).

A few things to be aware of if you are about to embark on the task of changing the VAT rate yourself:

  1. If the VAT rate is stored globally, make sure the VAT rate in use at the time has been stored with historical transactions (or at least the VAT charged has been stored) - and that changing the global rate will not affect reporting of existing transactions.
  2. If the VAT rate is stored globally and is easy to change, your prices will all change appropriately. But you may decide you don't want this - what about all those £9.99s becoming £9.77 ? In this case you may not want to pass the VAT cut on to your customers. You may be able to get round this issue by doing a global search directly in your database for net prices affected and replace them with net prices multiplied by the appropriate fraction to avoid the gross price changing - a bit complicated, but definitely preferable to changing hundreds of prices by hand.
  3. If you are having to change Coldfusion or PHP code, you might just be able to do a search and replace for everywhere the existing rate is mentioned. But remember to search for all the possible variations - 17.5, 0.175, 1.175, 117.5 etc - there are lots of ways to calculate VAT... (oh yeah, and just in case your developer was particularly obtuse, 85.10638297872340425531914893617 - the fraction to work out the net price from a gross price).
  4. Before you change anything, BACKUP, BACKUP, BACKUP, and after you've made the changes, TEST, TEST, TEST.
  5. Keep a note of the changes you've made, cause you're going to need to change it all back in 13 months time...

If you think you might need a hand with any of this for a Coldfusion or PHP e-commerce website, or a Filemaker Pro database, please get in touch or leave a comment below. It looks like it's going to be a busy weekend for everybody...

BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner