8000 session data needs to be encoded because it can contain non binary safe characters e.g null., part 2 by mvrhov · Pull Request #2384 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

session data needs to be encoded because it can contain non binary safe characters e.g null., part 2 #2384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function sessionRead($id)
))->fetchColumn();

if (false !== $data) {
return $data;
return base64_decode($data);
}

// session does not exist, create it
Expand Down Expand Up @@ -170,7 +170,8 @@ public function sessionWrite($id, $data)
$rowCount = $this->con->exec(sprintf(
$sql,
$this->con->quote($id),
$this->con->quote($data),
//session data can contain non binary safe characters so we need to encode it
$this->con->quote(base64_encode($data)),
time()
));

Expand All @@ -196,7 +197,8 @@ private function createNewSession($id, $data = '')
{
$this->con->exec(sprintf("INSERT INTO {$this->tableName} (sess_id, sess_data, sess_time) VALUES (%s, %s, %d)",
$this->con->quote($id),
$this->con->quote($data),
//session data can contain non binary safe characters so we need to encode it
$this->con->quote(base64_encode($data)),
time()
));

Expand Down
0