Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9cda96b

Browse filesBrowse files
committed
#27250 limiting GET_LOCK key up to 64 char due to changes in MySQL 5.7.5 and later
1 parent d7d4e41 commit 9cda96b
Copy full SHA for 9cda96b

File tree

1 file changed

+4
-2
lines changed
Filter options

1 file changed

+4
-2
lines changed

‎src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,14 +552,16 @@ private function doAdvisoryLock($sessionId)
552552
{
553553
switch ($this->driver) {
554554
case 'mysql':
555+
// MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced.
556+
$lockId = \substr($sessionId, 0, 64);
555557
// should we handle the return value? 0 on timeout, null on error
556558
// we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout
557559
$stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)');
558-
$stmt->bindValue(':key', $sessionId, \PDO::PARAM_STR);
560+
$stmt->bindValue(':key', $lockId, \PDO::PARAM_STR);
559561
$stmt->execute();
560562

561563
$releaseStmt = $this->pdo->prepare('DO RELEASE_LOCK(:key)');
562-
$releaseStmt->bindValue(':key', $sessionId, \PDO::PARAM_STR);
564+
$releaseStmt->bindValue(':key', $lockId, \PDO::PARAM_STR);
563565

564566
return $releaseStmt;
565567
case 'pgsql':

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.