@@ -206,8 +206,11 @@ public static function createConnection(string $dsn, array $options = [])
206
206
if (!isset ($ params ['redis_sentinel ' ])) {
207
207
break ;
208
208
}
209
-
210
- $ sentinel = new \RedisSentinel ($ host , $ port , $ params ['timeout ' ], (string ) $ params ['persistent_id ' ], $ params ['retry_interval ' ], $ params ['read_timeout ' ], ...\defined ('Redis::OPT_NULL_MULTIBULK_AS_NULL ' ) ? [$ params ['auth ' ] ?? '' ] : []);
209
+ $ extra = [];
210
+ if (\defined ('Redis::OPT_NULL_MULTIBULK_AS_NULL ' ) && isset ($ params ['auth ' ])) {
211
+ $ extra = [$ params ['auth ' ]];
212
+ }
213
+ $ sentinel = new \RedisSentinel ($ host , $ port , $ params ['timeout ' ], (string ) $ params ['persistent_id ' ], $ params ['retry_interval ' ], $ params ['read_timeout ' ], ...$ extra );
211
214
212
215
if ($ address = $ sentinel ->getMasterAddrByName ($ params ['redis_sentinel ' ])) {
213
216
[$ host , $ port ] = $ address ;
@@ -219,10 +222,13 @@ public static function createConnection(string $dsn, array $options = [])
219
222
}
220
223
221
224
try {
222
- @$ redis ->{$ connect }($ host , $ port , $ params ['timeout ' ], (string ) $ params ['persistent_id ' ], $ params ['retry_interval ' ], $ params ['read_timeout ' ], ...\defined ('Redis::SCAN_PREFIX ' ) ? [[
223
- 'auth ' => $ params ['auth ' ] ?? '' ,
225
+ $ extra = [
224
226
'stream ' => $ params ['ssl ' ] ?? null ,
225
- ]] : []);
227
+ ];
228
+ if (isset ($ params ['auth ' ])) {
229
+ $ extra ['auth ' ] = $ params ['auth ' ];
230
+ }
231
+ @$ redis ->{$ connect }($ host , $ port , $ params ['timeout ' ], (string ) $ params ['persistent_id ' ], $ params ['retry_interval ' ], $ params ['read_timeout ' ], ...\defined ('Redis::SCAN_PREFIX ' ) ? [$ extra ] : []);
226
232
227
233
set_error_handler (function ($ type , $ msg ) use (&$ error ) { $ error = $ msg ; });
228
234
try {
0 commit comments