Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #9644: Unable to preview survey when using database sessi…
…ons - link bug 09592 Dev: Overwrite quoteValue in DbConnection Dev: Implement DbHttpSession class: Call toQuoteValue with PDO::PARAM_LOB to get directly a bytea value Dev: Edit config sample and installer Dev: Edit kcfinder to check for application.core.web.DbHttpSession
- Loading branch information
1 parent
0a50260
commit 3d05380
Showing
9 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
class DbHttpSession extends \CDbHttpSession | ||
{ | ||
|
||
/** | ||
* Session write handler. | ||
* Do not call this method directly. | ||
* @param string $id session ID | ||
* @param string $data session data | ||
* @return boolean whether session write is successful | ||
*/ | ||
public function writeSession($id,$data) | ||
{ | ||
// exception must be caught in session write handler | ||
// http://us.php.net/manual/en/function.session-set-save-handler.php | ||
try | ||
{ | ||
$expire=time()+$this->getTimeout(); | ||
$db=$this->getDbConnection(); | ||
if($db->getDriverName()=='pgsql' ) | ||
$data=new CDbExpression($db->quoteValueExtended($data, PDO::PARAM_LOB)."::bytea"); | ||
if($db->getDriverName()=='sqlsrv' || $db->getDriverName()=='mssql' || $db->getDriverName()=='dblib') | ||
$data=new CDbExpression('CONVERT(VARBINARY(MAX), '.$db->quoteValue($data).')'); | ||
if($db->createCommand()->select('id')->from($this->sessionTableName)->where('id=:id',array(':id'=>$id))->queryScalar()===false) | ||
$db->createCommand()->insert($this->sessionTableName,array( | ||
'id'=>$id, | ||
'data'=>$data, | ||
'expire'=>$expire, | ||
)); | ||
else | ||
$db->createCommand()->update($this->sessionTableName,array( | ||
'data'=>$data, | ||
'expire'=>$expire | ||
),'id=:id',array(':id'=>$id)); | ||
} | ||
catch(Exception $e) | ||
{ | ||
if(YII_DEBUG) | ||
echo $e->getMessage(); | ||
// it is too late to log an error message here | ||
return false; | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters