From 69297ecb710a7c0d85ef4ff17b68fa89b96841fb Mon Sep 17 00:00:00 2001 From: Zander Baldwin Date: Tue, 21 May 2013 14:58:50 +0100 Subject: [PATCH] Prevent SQL Exception When Regenerating Session ID RE: yiisoft/yii#2491 Added a value (empty string) for the `data` column when inserting a new row into the session table; the `data` column does not allow null values nor does it have a default value assigned so the CDbCommand::insert() method was throwing an exception when the SQL command failed. --- CHANGELOG | 1 + framework/web/CDbHttpSession.php | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 10ab4443e..0b46ea6f4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -56,6 +56,7 @@ Version 1.1.14 work in progress - Bug #2426: CDbCriteria::__wakeup() used to issue an error in case SQL containing fields were arrays and criteria parameters were specified (resurtm) - Bug #2449: CSqlDataProvider causes an error when CDbCommand with enabled PDO::FETCH_OBJ mode used as SQL source (resurtm) - Bug #2454: Fix CMysqlColumnSchema::extractLimit for ENUM values containing comma (blueyed) +- Bug #2491: Prevent SQL exception being thrown when inserting a row into the session table whilst regenerating the session ID (mynameiszanders) - Enh: Better CFileLogRoute performance (Qiang, samdark) - Enh: Refactored CHttpRequest::getDelete and CHttpRequest::getPut not to use _restParams directly (samdark) - Enh #118: Proper support of namespaced models in forms (LastDragon-ru, Ekstazi, pgaultier) diff --git a/framework/web/CDbHttpSession.php b/framework/web/CDbHttpSession.php index c61db5c3b..f84f20f0f 100644 --- a/framework/web/CDbHttpSession.php +++ b/framework/web/CDbHttpSession.php @@ -126,6 +126,7 @@ class CDbHttpSession extends CHttpSession $db->createCommand()->insert($this->sessionTableName, array( 'id'=>$newID, 'expire'=>time()+$this->getTimeout(), + 'data'=>'', )); } }