|
@@ -181,7 +181,7 @@ class PdoSessionStorage extends NativeSessionStorage
|
|
$sessionRows = $stmt->fetchAll(\PDO::FETCH_NUM);
|
|
$sessionRows = $stmt->fetchAll(\PDO::FETCH_NUM);
|
|
|
|
|
|
if (count($sessionRows) == 1) {
|
|
if (count($sessionRows) == 1) {
|
|
- return $sessionRows[0][0];
|
|
|
|
|
|
+ return base64_decode($sessionRows[0][0]);
|
|
}
|
|
}
|
|
|
|
|
|
// session does not exist, create it
|
|
// session does not exist, create it
|
|
@@ -217,9 +217,11 @@ class PdoSessionStorage extends NativeSessionStorage
|
|
: "UPDATE $dbTable SET $dbDataCol = :data, $dbTimeCol = :time WHERE $dbIdCol = :id";
|
|
: "UPDATE $dbTable SET $dbDataCol = :data, $dbTimeCol = :time WHERE $dbIdCol = :id";
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
+ //session data can contain non binary safe characters so we need to encode it
|
|
|
|
+ $encoded = base64_encode($data);
|
|
$stmt = $this->db->prepare($sql);
|
|
$stmt = $this->db->prepare($sql);
|
|
$stmt->bindParam(':id', $id, \PDO::PARAM_STR);
|
|
$stmt->bindParam(':id', $id, \PDO::PARAM_STR);
|
|
- $stmt->bindParam(':data', $data, \PDO::PARAM_STR);
|
|
|
|
|
|
+ $stmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
|
|
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
|
|
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
|
|
$stmt->execute();
|
|
$stmt->execute();
|
|
|
|
|
|
@@ -251,9 +253,11 @@ class PdoSessionStorage extends NativeSessionStorage
|
|
|
|
|
|
$sql = "INSERT INTO $dbTable ($dbIdCol, $dbDataCol, $dbTimeCol) VALUES (:id, :data, :time)";
|
|
$sql = "INSERT INTO $dbTable ($dbIdCol, $dbDataCol, $dbTimeCol) VALUES (:id, :data, :time)";
|
|
|
|
|
|
|
|
+ //session data can contain non binary safe characters so we need to encode it
|
|
|
|
+ $encoded = base64_encode($data);
|
|
$stmt = $this->db->prepare($sql);
|
|
$stmt = $this->db->prepare($sql);
|
|
$stmt->bindParam(':id', $id, \PDO::PARAM_STR);
|
|
$stmt->bindParam(':id', $id, \PDO::PARAM_STR);
|
|
- $stmt->bindParam(':data', $data, \PDO::PARAM_STR);
|
|
|
|
|
|
+ $stmt->bindParam(':data', $encoded, \PDO::PARAM_STR);
|
|
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
|
|
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
|
|
$stmt->execute();
|
|
$stmt->execute();
|
|
|
|
|