#27250 limiting GET_LOCK key up to 64 char due to changes in MySQL 5.7.5 and later
This commit is contained in:
parent
d7d4e4169a
commit
9cda96b8b5
@ -552,14 +552,16 @@ class PdoSessionHandler implements \SessionHandlerInterface
|
|||||||
{
|
{
|
||||||
switch ($this->driver) {
|
switch ($this->driver) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
|
// MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced.
|
||||||
|
$lockId = \substr($sessionId, 0, 64);
|
||||||
// should we handle the return value? 0 on timeout, null on error
|
// should we handle the return value? 0 on timeout, null on error
|
||||||
// we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout
|
// we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout
|
||||||
$stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)');
|
$stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)');
|
||||||
$stmt->bindValue(':key', $sessionId, \PDO::PARAM_STR);
|
$stmt->bindValue(':key', $lockId, \PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
$releaseStmt = $this->pdo->prepare('DO RELEASE_LOCK(:key)');
|
$releaseStmt = $this->pdo->prepare('DO RELEASE_LOCK(:key)');
|
||||||
$releaseStmt->bindValue(':key', $sessionId, \PDO::PARAM_STR);
|
$releaseStmt->bindValue(':key', $lockId, \PDO::PARAM_STR);
|
||||||
|
|
||||||
return $releaseStmt;
|
return $releaseStmt;
|
||||||
case 'pgsql':
|
case 'pgsql':
|
||||||
|
Reference in New Issue
Block a user