CodeIgniter Forums
CI Session bug - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: CI Session bug (/showthread.php?tid=40411)

CI Session bug - El Forum - 04-07-2011

It's late and I'm pretty much tired but isn't this a bug:

1. Please first look at this:

as you can see for eache version of MySQL there is this line of text

"BLOB and TEXT columns cannot have DEFAULT values."

and if you go to User Guide and look a page about Session library:

you will notice this database structure:

session_id varchar(40) DEFAULT '0' NOT NULL,
ip_address varchar(16) DEFAULT '0' NOT NULL,
user_agent varchar(50) NOT NULL,
last_activity int(10) unsigned DEFAULT 0 NOT NULL,
user_data text DEFAULT '' NOT NULL,
PRIMARY KEY (session_id)

in which as you can see user_data is TEXT type field and is declared with default value. So can anybody tell me is this a bug, or I'm I just to tired Smile

CI Session bug - El Forum - 04-07-2011

I assume MySQL will ignore the default value for the text field when creating a table.

I just tested adding a default value to a text field in MySQL 5.0.77, this is the result:

SQL query:
ALTER TABLE  `blog1_post` CHANGE  `post_content`  `post_content` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT  'test'

MySQL said:
#1101 - BLOB/TEXT column 'post_content' can't have a default value

CI Session bug - El Forum - 04-07-2011

When creating a session table, remove 'NOT NULL' from the user_data column. A session record is actually created without data, and since it can't have a default value, the INSERT fails with an error.

This is an error in the docs...