You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Session/Storage/Handler/PdoSessionHandler.php
+13-24Lines changed: 13 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -184,30 +184,19 @@ public function createTable()
184
184
// connect if we are not yet
185
185
$this->getConnection();
186
186
187
-
switch ($this->driver) {
188
-
case'mysql':
189
-
// We use varbinary for the ID column because it prevents unwanted conversions:
190
-
// - character set conversions between server and client
191
-
// - trailing space removal
192
-
// - case-insensitivity
193
-
// - language processing like é == e
194
-
$sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED NOT NULL, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8mb4_bin, ENGINE = InnoDB";
195
-
break;
196
-
case'sqlite':
197
-
$sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)";
198
-
break;
199
-
case'pgsql':
200
-
$sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(128) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)";
201
-
break;
202
-
case'oci':
203
-
$sql = "CREATE TABLE $this->table ($this->idCol VARCHAR2(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)";
204
-
break;
205
-
case'sqlsrv':
206
-
$sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(128) NOT NULL PRIMARY KEY, $this->dataCol VARBINARY(MAX) NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)";
207
-
break;
208
-
default:
209
-
thrownew \DomainException(sprintf('Creating the session table is currently not implemented for PDO driver "%s".', $this->driver));
210
-
}
187
+
$sql = match ($this->driver) {
188
+
// We use varbinary for the ID column because it prevents unwanted conversions:
189
+
// - character set conversions between server and client
190
+
// - trailing space removal
191
+
// - case-insensitivity
192
+
// - language processing like é == e
193
+
'mysql' => "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED NOT NULL, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8mb4_bin, ENGINE = InnoDB",
194
+
'sqlite' => "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)",
195
+
'pgsql' => "CREATE TABLE $this->table ($this->idCol VARCHAR(128) NOT NULL PRIMARY KEY, $this->dataCol BYTEA NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)",
196
+
'oci' => "CREATE TABLE $this->table ($this->idCol VARCHAR2(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)",
197
+
'sqlsrv' => "CREATE TABLE $this->table ($this->idCol VARCHAR(128) NOT NULL PRIMARY KEY, $this->dataCol VARBINARY(MAX) NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)",
198
+
default => thrownew \DomainException(sprintf('Creating the session table is currently not implemented for PDO driver "%s".', $this->driver)),
0 commit comments