Skip to content

Commit

Permalink
Fixed issue #8649: Incorrect response when trying to invoke get_sessi…
Browse files Browse the repository at this point in the history
…on_key method via remotecontrol and using MSSQL
  • Loading branch information
c-schmitz committed Feb 3, 2014
1 parent d39999e commit 4cdb1bd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions application/models/Session.php
Expand Up @@ -49,5 +49,25 @@ public function primaryKey()
{
return 'id';
}

public function afterFind()
{
// MSSQL delivers hex data
$sDatabasetype = Yii::app()->db->getDriverName();
if($sDatabasetype=='sqlsrv' || $sDatabasetype=='mssql' || $sDatabasetype=='dblib')
{
$this->data=$this->hexToStr($this->data);
}
return parent::afterFind();
}

private function hexToStr($hex){
$string='';
for ($i=0; $i < strlen($hex)-1; $i+=2){
$string .= chr(hexdec($hex[$i].$hex[$i+1]));
}
return $string;
}

}
?>

0 comments on commit 4cdb1bd

Please sign in to comment.