Просмотр исходного кода

fixes reference for 5.3 in predis callback

Matt Wells 10 лет назад
Родитель
Сommit
ae2b2d0de1
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      src/Monolog/Handler/RedisHandler.php

+ 5 - 3
src/Monolog/Handler/RedisHandler.php

@@ -79,9 +79,11 @@ class RedisHandler extends AbstractProcessingHandler
                 ->ltrim($this->redisKey, 0, $this->capSize)
                 ->execute();
         } else {
-            $this->redisClient->transaction(function($tx) use($record) {
-                $tx->lpush($this->redisKey, $record["formatted"]);
-                $tx->ltrim($this->redisKey, 0, $this->capSize);
+            $redisKey = $this->redisKey;
+            $capSize = $this->capSize;
+            $this->redisClient->transaction(function($tx) use($record, $redisKey, $capSize) {
+                $tx->lpush($redisKey, $record["formatted"]);
+                $tx->ltrim($redisKey, 0, $capSize);
             });
         }
     }