@@ -124,12 +124,20 @@ public function open($path, $name): bool
124124
125125 $ redis = new Redis ();
126126
127- if (! $ redis ->connect ($ this ->savePath ['protocol ' ] . ':// ' . $ this ->savePath ['host ' ], ($ this ->savePath ['host ' ][0 ] === '/ ' ? 0 : $ this ->savePath ['port ' ]), $ this ->savePath ['timeout ' ])) {
127+ if (
128+ ! $ redis ->connect (
129+ $ this ->savePath ['protocol ' ] . ':// ' . $ this ->savePath ['host ' ],
130+ ($ this ->savePath ['host ' ][0 ] === '/ ' ? 0 : $ this ->savePath ['port ' ]),
131+ $ this ->savePath ['timeout ' ]
132+ )
133+ ) {
128134 $ this ->logger ->error ('Session: Unable to connect to Redis with the configured settings. ' );
129135 } elseif (isset ($ this ->savePath ['password ' ]) && ! $ redis ->auth ($ this ->savePath ['password ' ])) {
130136 $ this ->logger ->error ('Session: Unable to authenticate to Redis instance. ' );
131137 } elseif (isset ($ this ->savePath ['database ' ]) && ! $ redis ->select ($ this ->savePath ['database ' ])) {
132- $ this ->logger ->error ('Session: Unable to select Redis database with index ' . $ this ->savePath ['database ' ]);
138+ $ this ->logger ->error (
139+ 'Session: Unable to select Redis database with index ' . $ this ->savePath ['database ' ]
140+ );
133141 } else {
134142 $ this ->redis = $ redis ;
135143
@@ -251,7 +259,9 @@ public function destroy($id): bool
251259 {
252260 if (isset ($ this ->redis , $ this ->lockKey )) {
253261 if (($ result = $ this ->redis ->del ($ this ->keyPrefix . $ id )) !== 1 ) {
254- $ this ->logger ->debug ('Session: Redis::del() expected to return 1, got ' . var_export ($ result , true ) . ' instead. ' );
262+ $ this ->logger ->debug (
263+ 'Session: Redis::del() expected to return 1, got ' . var_export ($ result , true ) . ' instead. '
264+ );
255265 }
256266
257267 return $ this ->destroyCookie ();
@@ -303,7 +313,9 @@ protected function lockSession(string $sessionID): bool
303313 }
304314
305315 if (! $ this ->redis ->setex ($ lockKey , 300 , (string ) Time::now ()->getTimestamp ())) {
306- $ this ->logger ->error ('Session: Error while trying to obtain lock for ' . $ this ->keyPrefix . $ sessionID );
316+ $ this ->logger ->error (
317+ 'Session: Error while trying to obtain lock for ' . $ this ->keyPrefix . $ sessionID
318+ );
307319
308320 return false ;
309321 }
@@ -313,13 +325,19 @@ protected function lockSession(string $sessionID): bool
313325 } while (++$ attempt < 30 );
314326
315327 if ($ attempt === 30 ) {
316- log_message ('error ' , 'Session: Unable to obtain lock for ' . $ this ->keyPrefix . $ sessionID . ' after 30 attempts, aborting. ' );
328+ log_message (
329+ 'error ' ,
330+ 'Session: Unable to obtain lock for ' . $ this ->keyPrefix . $ sessionID . ' after 30 attempts, aborting. '
331+ );
317332
318333 return false ;
319334 }
320335
321336 if ($ ttl === -1 ) {
322- log_message ('debug ' , 'Session: Lock for ' . $ this ->keyPrefix . $ sessionID . ' had no TTL, overriding. ' );
337+ log_message (
338+ 'debug ' ,
339+ 'Session: Lock for ' . $ this ->keyPrefix . $ sessionID . ' had no TTL, overriding. '
340+ );
323341 }
324342
325343 $ this ->lock = true ;
0 commit comments