session_id in table sessions must be varchar(40)

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
raphael
Posts: 4
Joined: Tue Jan 12, 2010 9:37 am

session_id in table sessions must be varchar(40)

Postby raphael » Tue Jan 12, 2010 10:01 am

In php.ini if the hash function is sha1 :

Code: Select all

; 0: MD5   (128 bits) (php 5.x default)
; 1: SHA-1 (160 bits)
session.hash_function = 1



Instead of MD5 (the default) session_id in table sessions is too short to store
the session value (40 chars with sha1). Thus it is impossible to do anything
after install because it triggers a "duplicate key" error found in the sessions
table.

Suggested fix with utf-8 tables :

Code: Select all

 ALTER TABLE `sessions` CHANGE `session_id` `session_id` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL 


and everything works fine.

Otherwise one should fall back to the php.ini default of MD5 session hash.

I filed a bug with this info : http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=5033

Raphaël

asmecher
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm
Contact:

Re: session_id in table sessions must be varchar(40)

Postby asmecher » Tue Jan 12, 2010 11:55 am

Hi Raphaël,

Thanks! Note that you should also update the session_id column in the "captchas" table. It's also best to make sure you update the database descriptors (dbscripts/xml/ojs_schema.xml in pre-2.3 applications, or lib/pkp/xml/schema/common.xml in 2.3 and later); otherwise, when the database is synced against the descriptor during an upgrade, your changes to the live database may be reverted.

See the Bugzilla entry for patches to update the database descriptors.

Regards,
Alec Smecher
Public Knowledge Project Team

raphael
Posts: 4
Joined: Tue Jan 12, 2010 9:37 am

Re: session_id in table sessions must be varchar(40)

Postby raphael » Tue Jan 12, 2010 5:33 pm

Hi Alec,
thank you very much for the patches, I'm impressed with how fast you fixed it.

regards,
Raphaël


Return to “OCS Technical Support”

Who is online

Users browsing this forum: No registered users and 2 guests