Skip to content

Commit 57ee387

Browse files
committed
fix: possible regression tcp and tls in Redis
1 parent 1e8b87c commit 57ee387

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

system/Session/Handlers/RedisHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ protected function setSavePath(): void
103103
throw SessionException::forEmptySavepath();
104104
}
105105

106-
if (preg_match('#(?:(^.*)://)?([^:?]+)(?:\:(\d+))?(\?.+)?#', $this->savePath, $matches)) {
106+
if (preg_match('#(?:(tcp|tls)://)?([^:?]+)(?:\:(\d+))?(\?.+)?#', $this->savePath, $matches)) {
107107
if (! isset($matches[4])) {
108108
$matches[4] = ''; // Just to avoid undefined index notices below
109109
}
110110

111111
$this->savePath = [
112-
'protocol' => in_array($matches[1], ['tcp', 'tls'], true) ? $matches[1] : self::DEFAULT_PROTOCOL,
112+
'protocol' => ! empty($matches[1]) ? $matches[1] : self::DEFAULT_PROTOCOL,
113113
'host' => $matches[2],
114114
'port' => empty($matches[3]) ? self::DEFAULT_PORT : $matches[3],
115115
'password' => preg_match('#auth=([^\s&]+)#', $matches[4], $match) ? $match[1] : null,

0 commit comments

Comments
 (0)