Skip to content

Commit

Permalink
Fix PHP 8.1 compatibility issues. Refs #46
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmollenhour committed Aug 16, 2022
1 parent 77ad0c1 commit a79e3a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Cm/RedisSession/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public function __construct(ConfigInterface $config, LoggerInterface $logger, $r

// Connect and authenticate
if ($sentinelServers && $sentinelMaster) {
$servers = preg_split('/\s*,\s*/', trim($sentinelServers), NULL, PREG_SPLIT_NO_EMPTY);
$servers = preg_split('/\s*,\s*/', trim($sentinelServers), -1, PREG_SPLIT_NO_EMPTY);
$sentinel = NULL;
$exception = NULL;
for ($i = 0; $i <= $sentinelConnectRetries; $i++) // Try to connect to sentinels in round-robin fashion
Expand Down Expand Up @@ -333,23 +333,23 @@ public function __construct(ConfigInterface $config, LoggerInterface $logger, $r
if ($pass) $redisMaster->auth($pass);
$roleData = $redisMaster->role();
if ( ! $roleData || $roleData[0] != 'master') {
throw new Exception('Unable to determine master redis server.');
throw new \Exception('Unable to determine master redis server.');
}
}
}
if ($this->_dbNum || $persistent) $redisMaster->select(0);

$this->_redis = $redisMaster;
break 2;
} catch (Exception $e) {
} catch (\Exception $e) {
unset($sentinelClient);
$exception = $e;
}
}
unset($sentinel);

if ( ! $this->_redis) {
throw new ConnectionFailedException('Unable to connect to a Redis: '.$exception->getMessage(), $exception);
throw new ConnectionFailedException('Unable to connect to a Redis: '.$exception->getMessage(), 0, $exception);
}
}
else {
Expand Down

0 comments on commit a79e3a0

Please sign in to comment.