hello worlb!

// A simple blog about programming and the web

Upgrading CodeIgniter from 1.7 to 2.0

November 6th, 2011

I’ve recently upgraded an app I’ve been developing with CodeIgniter¬†to their latest version. There’s been a lot of changes, which you can read in their Change Log, the most notably probably being the first one; CodeIgniter no longer supports PHP4!

Switching over my app was mostly painless. I was actually surprised that I had most of it working immediately. There’s a short guide on making the upgrade in the CI docs, but unfortunately it didn’t cover everything for me. Here’s a couple things I ran into which I hope might help someone else out:

CodeIgniter was creating a new session on every request. In this app I’m storing the sessions in the database. It was a bit confusing since I was using the exact same development environment and settings as I was with the 1.7.2 app.

The problem? CI2 saves a much longer user agent string then older versions, and there field in the database wasn’t long enough to store it, so it was getting cutoff. You’ll need to change the ‘user_agent‘ field in your sessions table from VARCHAR(50) to¬†VARCHAR(120).

The second issue was much easier to debug. The xss_clean function has moved from the input class to a new security class. So you’ll have to change all calls to that method.

 

© Copyright 2014 Hello Worlb!

Home | RSS Feed | Contact | About | ♥ eyehack ♥